File.prototype.new()

Create a new file.

Syntax

file.new() file.new(placement uint32, name string) File file.new(placement uint32, name string, bucketId uint8) File

Parameters

placement uint32

Where to place the new file relative the the referenced one, one of [os.BEFORE, os.AFTER, os.PREPEND, os.APPEND].

Additionally, there are modifiers which affect how conflicts are resolved, one or more of [os.FORCE, os.RENAME, os.TYPESAFE, os.TYPESAFE_IF_POSSIBLE].

See file placement for more details.

When omitted, defaults to (os.APPEND | os.RENAME).

name string

File’s name. It is invalid to use special characters like spaces. When omitted, defaults to "new".

bucketId uint8

Which bucket to place the file in.

When omitted, defaults to 0.

Description

Create a new file relative to the referenced one. The file does not need to be explicitly stored, every file operation is automatically commited to disk once the transaction successfully exits.

Examples

Minimal example, no arguments provided.

Equivalent method call with all arguments provided.

Example with all arguments provided.

Placement os.PREPEND.

Placement os.APPEND.

Placement os.BEFORE.

Placement os.AFTER.

It is invalid to use spaces or special chars in the.

Subscribe to our newsletter!