Module: tastypie/fields/file

A field type for dealing with incoming file streams.
Will write the file to a location and store its path


new (require("tastypie/fields/file"))(options)

Extends:
Parameters:
Name Type Description
options Object
Properties
Name Type Argument Default Description
stream Boolean <optional>
false
root String <optional>
os.tempDir()
dir String <optional>
create Boolean <optional>
false

Auto create the resolved directory

Source:

Requires

Methods


<protected> augment(resource, name)

Injects dynamic properties onto field instance for later use

Parameters:
Name Type Description
resource Resource

the resource instance this field is attached to

name String

The property name this field is associated to

Inherited From:
Source:

convert(val)

Converts data value into the serialization specific type.

Parameters:
Name Type Description
val Mixed

value to convert

Inherited From:
Source:
Returns:

value The converted field value

Type
Mixed

dehydrate(object, attribute)

Converts a javascript object / value into something sutable for seriaation. ex. Date formatting

Parameters:
Name Type Description
object Object

Object to dehydrate before serialization

attribute Sting | function

a name path or function to use to retrieve a value from the object

Inherited From:
Source:
Returns:

value object value converted to its internal type

Type
Mixed

format()

returns a sample of the format expected and returned by a field

Inherited From:
Source:
Returns:

The format expected for a particular field type

Type
String | undefined

hydrate(bundle)

Converts a serialized value in to a javascript object value

Parameters:
Name Type Description
bundle Bundle

a bundle representing the current request

Inherited From:
Source: