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

- customName
- filename
- 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:69

  #### Parameters

  - ##### _file: FileInstance

  - ##### Optional _sanitizeOptions: SanitizeOptions

  #### Returns File

## Properties

### container

container: string

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

### handle

handle: string

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

### key

key: string

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

### status

status: FileState

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

### url

url: string

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

### workflows

workflows: any[]

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

## Accessors

### customName

customName:

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

Sets custom name using string or function Name will be sanitized

memberof

  File

### filename

filename:

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

Alias for name getter

readonly
type

  {string}

memberof

  File

### mimetype

mimetype:

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

Alias for file type

readonly
type

  {string}

memberof

  File

### name

name:

- Defined in lib/api/upload/file.ts:81
- Defined in lib/api/upload/file.ts:101

Returns file name Sets new file name and cleanup extra chars

memberof

  File

memberof

  File

### size

size:

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

Returns file size

memberof

  File

### type

type:

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

Returns file type

default

  'application/octet-stream'

memberof

  File

## Methods

### getChunkByMetadata

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

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

  Returns part chunk

  memberof

    File

  #### Parameters

  - ##### meta: FilePartMetadata

  - ##### offset: number

  - ##### chunkSize: number

  #### Returns Promise<FileChunk>

### getPartByMetadata

- getPartByMetadata(meta: FilePartMetadata): Promise<FilePart>

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

  Returns part metadata + buffer

  memberof

    File

  #### Parameters

  - ##### meta: FilePartMetadata

  #### Returns Promise<FilePart>

### getPartMetadata

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

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

  Returns part metadata

  memberof

    File

  #### Parameters

  - ##### partNum: number

  - ##### size: any

  #### Returns FilePartMetadata

### getPartsCount

- getPartsCount(size: number): number

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

  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:243

  Cleanup file buffer to release memory

  memberof

    File

  #### Returns void

### toJSON

- toJSON(): object

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

  #### Returns object

  - ##### handle: string

  - ##### name: string

  - ##### size: number

  - ##### status: FileState

  - ##### type: string

  - ##### url: string