[**Documentation**](../../../README)

***

[Documentation](../../../README) / [zerotal](../../README) / [testing](../README) / fakeFile

# Variable: fakeFile

> `const` **fakeFile**: `object`

Defined in: [packages/testing/src/fakeFile.ts:23](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/testing/src/fakeFile.ts#L23)

## Type Declaration

### create()

> **create**(`name`, `content?`, `type?`): `File`

A file with exactly the contents you give it.

#### Parameters

##### name

`string`

Filename sent with the upload.

##### content?

`string` \| `Uint8Array`\<`ArrayBufferLike`\>

File contents; a string is encoded as UTF-8.

##### type?

`string` = `"text/plain"`

MIME type declared for the part.

#### Returns

`File`

### sized()

> **sized**(`name`, `size`, `type?`): `File`

A file of `size` bytes, for exercising size limits. The contents are filler,
so use [image](#image) or [pdf](#pdf) when the bytes have to be recognisable.

#### Parameters

##### name

`string`

##### size

`number`

##### type?

`string` = `"application/octet-stream"`

#### Returns

`File`

#### Example

```ts
// Over a 2 MB limit
fakeFile.sized('huge.bin', 3 * 1024 * 1024);
```

### image()

> **image**(`name?`, `options?`): `File`

A valid PNG image of the given dimensions.

#### Parameters

##### name?

`string` = `"image.png"`

Filename sent with the upload.

##### options?

###### width?

`number`

Pixel width (default 10).

###### height?

`number`

Pixel height (default 10).

#### Returns

`File`

#### Example

```ts
fakeFile.image('avatar.png', { width: 64, height: 64 });
```

### jpeg()

> **jpeg**(`name?`): `File`

A minimal but structurally valid JPEG.

#### Parameters

##### name?

`string` = `"image.jpg"`

#### Returns

`File`

### gif()

> **gif**(`name?`): `File`

A minimal GIF89a image.

#### Parameters

##### name?

`string` = `"image.gif"`

#### Returns

`File`

### pdf()

> **pdf**(`name?`): `File`

A minimal one-page PDF.

#### Parameters

##### name?

`string` = `"document.pdf"`

#### Returns

`File`
