Skip to main content

LocalStorageFile

@quik/storage-express


@quik/storage-express / LocalStorageFile

Class: LocalStorageFile

Defined in: storage-express/src/local.ts:350

Extends

  • QStorageFile

Constructors

Constructor

new LocalStorageFile(): LocalStorageFile

Returns

LocalStorageFile

Inherited from

QStorageFile.constructor

Properties

_baseName

protected _baseName: string

Defined in: storage-express/src/local.ts:370

Derived base filename (without extension).


_cachedDefaults?

protected optional _cachedDefaults?: Record<string, any>

Defined in: entity/src/QEntity.ts:45

Default values for entity fields based on field definitions.

Inherited from

QStorageFile._cachedDefaults


_definition

protected _definition: QEntityDefinition

Defined in: entity/src/QEntity.ts:95

Definition of entity fields and their metadata.

Inherited from

QStorageFile._definition


_entityName

protected _entityName: string

Defined in: entity/src/QEntity.ts:83

Name of the entity type.

Inherited from

QStorageFile._entityName


_hooks

protected _hooks: QEntityHook

Defined in: entity/src/QEntity.ts:133

Collection of registered lifecycle hooks for this entity.

Inherited from

QStorageFile._hooks


_initialFill

protected _initialFill: boolean = false

Defined in: entity/src/QEntity.ts:33

Flag indicating if entity is being initially filled.

Inherited from

QStorageFile._initialFill


_isFillMethodActive

protected _isFillMethodActive: boolean = false

Defined in: entity/src/QEntity.ts:121

Flag indicating if the fill method is currently executing.

Inherited from

QStorageFile._isFillMethodActive


_modifiedFields

protected _modifiedFields: string[]

Defined in: entity/src/QEntity.ts:41

List of field names that have been modified since creation.

Inherited from

QStorageFile._modifiedFields


_rowState

protected _rowState: QRowState

Defined in: entity/src/QEntity.ts:50

Current state of the entity row (created, modified, deleted, etc).

Inherited from

QStorageFile._rowState


_runHooks

protected _runHooks: boolean = true

Defined in: entity/src/QEntity.ts:37

Flag controlling whether lifecycle hooks should be executed.

Inherited from

QStorageFile._runHooks


_sealed

protected _sealed: boolean = false

Defined in: entity/src/QEntity.ts:71

Flag to mark an object as sealed.

Inherited from

QStorageFile._sealed


contents?

optional contents?: string

Defined in: storage/src/entities/QStorageFile.ts:57

Base64-encoded file contents.

Inherited from

QStorageFile.contents


destination

destination: string

Defined in: storage-express/src/local.ts:365

Destination directory where the file will be moved.


encoding

encoding: string

Defined in: storage/src/entities/QStorageFile.ts:20

File encoding.

Inherited from

QStorageFile.encoding


engine

engine: string

Defined in: storage/src/entities/QStorageFile.ts:50

Storage engine name.

Inherited from

QStorageFile.engine


extension

extension: string

Defined in: storage/src/entities/QStorageFile.ts:44

File extension.

Inherited from

QStorageFile.extension


fieldName

fieldName: string

Defined in: storage-express/src/local.ts:355

Form field name associated with the upload.


fileName

fileName: string

Defined in: storage/src/entities/QStorageFile.ts:14

File name.

Inherited from

QStorageFile.fileName


mimeType

mimeType: string

Defined in: storage/src/entities/QStorageFile.ts:26

MIME type for the file.

Inherited from

QStorageFile.mimeType


originalName

originalName: string

Defined in: storage-express/src/local.ts:360

Original file name supplied by the client.


path

path: string

Defined in: storage/src/entities/QStorageFile.ts:32

Storage path for the file.

Inherited from

QStorageFile.path


size

size: number

Defined in: storage/src/entities/QStorageFile.ts:38

File size in bytes.

Inherited from

QStorageFile.size


Entity

readonly static Entity: "QEntity" = "QEntity"

Defined in: entity/src/QEntity.ts:28

Entity name identifier, used for metadata lookup.

Inherited from

QStorageFile.Entity

Accessors

baseName

Get Signature

get baseName(): string

Defined in: storage-express/src/local.ts:375

Base filename derived from originalName.

Returns

string


canRunHooks

Get Signature

get protected canRunHooks(): boolean

Defined in: entity/src/QEntity.ts:145

Gets whether lifecycle hooks can be executed.

Returns

boolean

Inherited from

QStorageFile.canRunHooks


defaultValues

Get Signature

get protected defaultValues(): Record<string, any>

Defined in: entity/src/QEntity.ts:163

Returns

Record<string, any>

Inherited from

QStorageFile.defaultValues


definition

Get Signature

get definition(): QEntityDefinition

Defined in: entity/src/QEntity.ts:100

Gets the entity field definitions.

Returns

QEntityDefinition

Inherited from

QStorageFile.definition


entityName

Get Signature

get entityName(): string

Defined in: entity/src/QEntity.ts:88

Gets the entity type name.

Returns

string

Inherited from

QStorageFile.entityName


fields

Get Signature

get fields(): string[]

Defined in: entity/src/QEntity.ts:107

Gets the list of field names defined on this entity.

Returns

string[]

Inherited from

QStorageFile.fields


fullPath

Get Signature

get fullPath(): string

Defined in: storage-express/src/local.ts:382

Absolute path to the stored file.

Returns

string


hooks

Get Signature

get protected hooks(): QEntityHook

Defined in: entity/src/QEntity.ts:138

Gets the registered lifecycle hooks.

Returns

QEntityHook

Inherited from

QStorageFile.hooks


isFillMethodActive

Get Signature

get protected isFillMethodActive(): boolean

Defined in: entity/src/QEntity.ts:126

Gets whether the fill method is currently active.

Returns

boolean

Inherited from

QStorageFile.isFillMethodActive


isInitialFill

Get Signature

get protected isInitialFill(): boolean

Defined in: entity/src/QEntity.ts:152

Gets whether entity is being initially filled.

Returns

boolean

Inherited from

QStorageFile.isInitialFill


isSealed

Get Signature

get isSealed(): boolean

Defined in: entity/src/QEntity.ts:76

Read-only flag to check if the object is sealed.

Returns

boolean

Inherited from

QStorageFile.isSealed


logger

Get Signature

get protected logger(): IQLogger

Defined in: entity/src/QEntity.ts:159

The logger instance for this entity.

Returns

IQLogger

Inherited from

QStorageFile.logger


rowState

Get Signature

get rowState(): QRowState

Defined in: entity/src/QEntity.ts:55

Gets the current row state of the entity.

Returns

QRowState

Set Signature

set rowState(rowState): void

Defined in: entity/src/QEntity.ts:64

Sets the current row state of the entity.

Parameters
rowState

QRowState

New row state

Returns

void

Inherited from

QStorageFile.rowState


selectableFields

Get Signature

get selectableFields(): string[]

Defined in: entity/src/QEntity.ts:114

Gets all fields marked as selectable in queries.

Returns

string[]

Inherited from

QStorageFile.selectableFields

Methods

clone()

clone(properties?): LocalStorageFile

Defined in: entity/src/QEntity.ts:283

Creates a clone of the current entity.

Parameters

properties?

QEntityOptions<LocalStorageFile>

A list of properties that you want to pass to the new instance

Returns

LocalStorageFile

Inherited from

QStorageFile.clone


compare()

compare(other): boolean

Defined in: entity/src/QEntity.ts:362

Compares this entity with another entity for deep equality.

Parameters

other

QEntity

The other entity to compare with

Returns

boolean

True if entities are equal, false otherwise

Inherited from

QStorageFile.compare


copyTo()

copyTo(targetEngine, targetPath): Promise<void>

Defined in: storage/src/entities/QStorageFile.ts:118

Copy this file to another storage engine.

Parameters

targetEngine

QStorageEngineBase

Target storage engine.

targetPath

string

Destination path in the target engine.

Returns

Promise<void>

Throws

StorageEngineNotLoadedError when the storage engine is missing.

Inherited from

QStorageFile.copyTo


disableHooks()

protected disableHooks(): void

Defined in: entity/src/QEntity.ts:455

Disables execution of lifecycle hooks.

Returns

void

Inherited from

QStorageFile.disableHooks


enableHooks()

protected enableHooks(): void

Defined in: entity/src/QEntity.ts:462

Enables execution of lifecycle hooks.

Returns

void

Inherited from

QStorageFile.enableHooks


fill()

fill(options?, initial?, fillOptions?): LocalStorageFile

Defined in: entity/src/QEntity.ts:184

Method used to init the entity with data.

Parameters

options?

QEntityOptions<LocalStorageFile>

A map of properties with values that can be filled in the current entity

initial?

boolean = false

Initial row fill

fillOptions?

QEntityFillOptions

Returns

LocalStorageFile

Inherited from

QStorageFile.fill


fillContents()

fillContents(): Promise<QStorageFile>

Defined in: storage/src/entities/QStorageFile.ts:64

Load file contents from the backing storage engine.

Returns

Promise<QStorageFile>

Throws

StorageEngineNotLoadedError when the storage engine is missing.

Inherited from

QStorageFile.fillContents


freeze()

freeze(): void

Defined in: entity/src/QEntity.ts:301

Freezes the current entity to the current values and properties list. Prevents any further modifications to the entity.

Returns

void

Inherited from

QStorageFile.freeze


getFlaggedField()

getFlaggedField(flag): string[]

Defined in: entity/src/QEntity.ts:407

Gets all fields that have a specific flag.

Parameters

flag

string

Flag to check for

Returns

string[]

Array of field names with the flag

Inherited from

QStorageFile.getFlaggedField


getHooks()

protected getHooks(name): MethodDecoratorType<QEntity, any[], unknown>[]

Defined in: entity/src/QEntity.ts:448

Gets all registered hooks of a specific type.

Parameters

name

HookType

Type of hooks to retrieve

Returns

MethodDecoratorType<QEntity, any[], unknown>[]

Inherited from

QStorageFile.getHooks


getUrl()

getUrl(expiresIn?): Promise<string>

Defined in: storage/src/entities/QStorageFile.ts:106

Resolve a public URL for this file.

Parameters

expiresIn?

number

Expiration time in seconds for signed URLs.

Returns

Promise<string>

Throws

StorageEngineNotLoadedError when the storage engine is missing.

Inherited from

QStorageFile.getUrl


isDeleted()

isDeleted(): boolean

Defined in: entity/src/QEntity.ts:274

Checks if the entity is marked as deleted.

Returns

boolean

Inherited from

QStorageFile.isDeleted


isFieldModified()

protected isFieldModified(field): boolean

Defined in: entity/src/QEntity.ts:422

Checks if a field has been modified since entity creation.

Parameters

field

string

Field name to check

Returns

boolean

Inherited from

QStorageFile.isFieldModified


isModified()

isModified(): boolean

Defined in: entity/src/QEntity.ts:253

Checks if the entity has been modified (created or updated).

Returns

boolean

Inherited from

QStorageFile.isModified


isNew()

isNew(): boolean

Defined in: entity/src/QEntity.ts:260

Checks if the entity is newly created.

Returns

boolean

Inherited from

QStorageFile.isNew


isUnmodified()

isUnmodified(): boolean

Defined in: entity/src/QEntity.ts:246

Checks if the entity is in an unmodified state.

Returns

boolean

Inherited from

QStorageFile.isUnmodified


isUpdated()

isUpdated(): boolean

Defined in: entity/src/QEntity.ts:267

Checks if the entity has been updated after creation.

Returns

boolean

Inherited from

QStorageFile.isUpdated


markDeleted()

markDeleted(): void

Defined in: entity/src/QEntity.ts:232

Marks the entity as deleted.

Returns

void

Inherited from

QStorageFile.markDeleted


markModified()

markModified(): void

Defined in: entity/src/QEntity.ts:239

Marks the entity as modified.

Returns

void

Inherited from

QStorageFile.markModified


moveTo()

moveTo(targetEngine, targetPath): Promise<void>

Defined in: storage/src/entities/QStorageFile.ts:130

Move this file to another storage engine.

Parameters

targetEngine

QStorageEngineBase

Target storage engine.

targetPath

string

Destination path in the target engine.

Returns

Promise<void>

Throws

StorageEngineNotLoadedError when the storage engine is missing.

Inherited from

QStorageFile.moveTo


moveToDestination()

moveToDestination(destination?): Promise<LocalStorageFile>

Defined in: storage-express/src/local.ts:392

Move the file to a new destination on disk.

Parameters

destination?

string

Path to move the file to. Defaults to the configured destination folder.

Returns

Promise<LocalStorageFile>


onAfterFill()

protected onAfterFill(): void

Defined in: storage-express/src/local.ts:418

Returns

void


reload()

reload(fill?): Promise<QStorageFile>

Defined in: storage/src/entities/QStorageFile.ts:80

Reload metadata (and optionally contents) from the backing storage engine.

Parameters

fill?

boolean = false

Whether to load contents into memory.

Returns

Promise<QStorageFile>

Throws

StorageEngineNotLoadedError when the storage engine is missing.

Inherited from

QStorageFile.reload


runHooks()

protected runHooks(name): void

Defined in: entity/src/QEntity.ts:431

Executes all registered hooks of a specific type.

Parameters

name

HookType

Type of hooks to run

Returns

void

Inherited from

QStorageFile.runHooks


setInitialFill()

protected setInitialFill(): void

Defined in: entity/src/QEntity.ts:469

Marks the entity as being initially filled.

Returns

void

Inherited from

QStorageFile.setInitialFill


toJSON()

toJSON(): ObjectLiteral

Defined in: entity/src/QEntity.ts:312

Returns the data from the entity as a serializable object.

This method transforms the entity to a plain object suitable for JSON serialization, hiding internal properties and fields marked as hidden.

Returns

ObjectLiteral

Inherited from

QStorageFile.toJSON


toObject()

toObject<T>(): T

Defined in: entity/src/QEntity.ts:345

Return the data from the entity as an object.

Use this method when you want to extract the data from the entity. This is an alias for the toJSON method.

Type Parameters

T

T = ObjectLiteral

Returns

T

Inherited from

QStorageFile.toObject


toString()

toString(): string

Defined in: entity/src/QEntity.ts:352

Returns a string representation of the entity.

Returns

string

Inherited from

QStorageFile.toString


unsetInitialFill()

protected unsetInitialFill(): void

Defined in: entity/src/QEntity.ts:476

Marks the entity as no longer being initially filled.

Returns

void

Inherited from

QStorageFile.unsetInitialFill


validate()

validate(returnable?): Promise<QEntityValidationResults>

Defined in: entity/src/QEntity.ts:371

Validate the entity fields.

Parameters

returnable?

boolean

When true, return validation errors instead of throwing

Returns

Promise<QEntityValidationResults>

Inherited from

QStorageFile.validate