File representation to unify file object in nodejs and browser

export
class

  File

### Hierarchy

- File

## Index

### Constructors

- constructor

### Properties

- container
- handle
- key
- status
- url
- workflows

### Accessors

- buffer
- customName
- filename
- md5
- mimetype
- name
- size
- type

### Methods

- getChunkByMetadata
- getPartByMetadata
- getPartMetadata
- getPartsCount
- release
- toJSON

## Constructors

### constructor

- new File(_file: FileInstance, _sanitizeOptions?: SanitizeOptions): File

- - Defined in lib/api/upload/file.ts:70

  #### Parameters

  - ##### _file: FileInstance

  - ##### Optional _sanitizeOptions: SanitizeOptions

  #### Returns File

## Properties

### container

container: string

- Defined in lib/api/upload/file.ts:66

### handle

handle: string

- Defined in lib/api/upload/file.ts:62

### key

key: string

- Defined in lib/api/upload/file.ts:68

### status

status: FileState

- Defined in lib/api/upload/file.ts:60

### url

url: string

- Defined in lib/api/upload/file.ts:64

### workflows

workflows: any[]

- Defined in lib/api/upload/file.ts:70

## Accessors

### buffer

buffer:

- Defined in lib/api/upload/file.ts:157

Returns file buffer

memberof

  File

### customName

customName:

- Defined in lib/api/upload/file.ts:112

Sets custom name using string or function Name will be sanitized

memberof

  File

### filename

filename:

- Defined in lib/api/upload/file.ts:93

Alias for name getter

readonly
type

  {string}

memberof

  File

### md5

md5:

- Defined in lib/api/upload/file.ts:177

Returns file md5 checksum

memberof

  File

### mimetype

mimetype:

- Defined in lib/api/upload/file.ts:147

Alias for file type

readonly
type

  {string}

memberof

  File

### name

name:

- Defined in lib/api/upload/file.ts:82
- Defined in lib/api/upload/file.ts:102

Returns file name Sets new file name and cleanup extra chars

memberof

  File

memberof

  File

### size

size:

- Defined in lib/api/upload/file.ts:167

Returns file size

memberof

  File

### type

type:

- Defined in lib/api/upload/file.ts:135

Returns file type

default

  'application/octet-stream'

memberof

  File

## Methods

### getChunkByMetadata

- getChunkByMetadata(meta: FilePartMetadata, offset: number, chunkSize: number): FileChunk

- - Defined in lib/api/upload/file.ts:248

  Returns part chunk

  memberof

    File

  #### Parameters

  - ##### meta: FilePartMetadata

  - ##### offset: number

  - ##### chunkSize: number

  #### Returns FileChunk

### getPartByMetadata

- getPartByMetadata(meta: FilePartMetadata): FilePart

- - Defined in lib/api/upload/file.ts:229

  Returns part metadata + buffer

  memberof

    File

  #### Parameters

  - ##### meta: FilePartMetadata

  #### Returns FilePart

### getPartMetadata

- getPartMetadata(partNum: number, size: any): FilePartMetadata

- - Defined in lib/api/upload/file.ts:205

  Returns part metadata

  memberof

    File

  #### Parameters

  - ##### partNum: number

  - ##### size: any

  #### Returns FilePartMetadata

### getPartsCount

- getPartsCount(size: number): number

- - Defined in lib/api/upload/file.ts:193

  Returns number of parts according to part size

  memberof

    File

  #### Parameters

  - ##### size: number

    part size in bytes

  #### Returns number

### release

- release(): void

- - Defined in lib/api/upload/file.ts:269

  Cleanup file buffer to release memory

  memberof

    File

  #### Returns void

### toJSON

- toJSON(): object

- - Defined in lib/api/upload/file.ts:273

  #### Returns object

  - ##### handle: string

  - ##### name: string

  - ##### size: number

  - ##### status: FileState

  - ##### type: string

  - ##### url: string