Skip to content

Minima.js API


Minima.js API / @minimajs/disk / adapters / FsDriver

Class: FsDriver ​

Filesystem storage driver for @minimajs/disk

Implements ​

Constructors ​

Constructor ​

ts
new FsDriver(options): FsDriver;

Parameters ​

options ​

FsDriverBaseOptions

Returns ​

FsDriver

Properties ​

name ​

ts
readonly name: "fs" = "fs";

Driver name (e.g., 'fs', 's3', 'azure')

Implementation of ​

DiskDriver.name

Accessors ​

[toStringTag] ​

Get Signature ​

ts
get toStringTag: string;
Returns ​

string


capabilities ​

Get Signature ​

ts
get capabilities(): DriverCapabilities;

Optional capability declarations — see DriverCapabilities

Returns ​

DriverCapabilities

Optional capability declarations — see DriverCapabilities

Implementation of ​

DiskDriver.capabilities

Methods ​

[custom]() ​

ts
custom: {
  [toStringTag]: string;
  name: string;
  publicUrl: string | undefined;
  root: string;
  sidecarMetadata: boolean;
};

Returns ​

ts
{
  [toStringTag]: string;
  name: string;
  publicUrl: string | undefined;
  root: string;
  sidecarMetadata: boolean;
}
[toStringTag] ​
ts
[toStringTag]: string = "FsDriver";
name ​
ts
name: string;
publicUrl ​
ts
publicUrl: string | undefined;
root ​
ts
root: string;
sidecarMetadata ​
ts
sidecarMetadata: boolean;

copy() ​

ts
copy(
   from, 
   to, 
options): Promise<void>;

Copy a file to a new location

Parameters ​

from ​

string

Source absolute URL/URI

to ​

string

Destination absolute URL/URI

options ​
signal? ​

AbortSignal

Returns ​

Promise<void>

Implementation of ​

DiskDriver.copy


delete() ​

ts
delete(href, options): Promise<void>;

Delete file by href

Parameters ​

href ​

string

Absolute URL/URI with protocol

options ​
signal? ​

AbortSignal

Returns ​

Promise<void>

Implementation of ​

DiskDriver.delete


exists() ​

ts
exists(href, options): Promise<boolean>;

Check if file exists

Parameters ​

href ​

string

Absolute URL/URI with protocol

options ​
signal? ​

AbortSignal

Returns ​

Promise<boolean>

Implementation of ​

DiskDriver.exists


get() ​

ts
get(href, options): Promise<
  | [ReadableStream<Uint8Array<ArrayBufferLike>>, FileMetadata]
| null>;

Retrieve file as a ReadableStream with metadata

Parameters ​

href ​

string

Absolute URL/URI with protocol

options ​
signal? ​

AbortSignal

Returns ​

Promise< | [ReadableStream<Uint8Array<ArrayBufferLike>>, FileMetadata] | null>

Tuple of [stream, metadata] or null if not found

Implementation of ​

DiskDriver.get


list() ​

ts
list(prefix, listOptions): AsyncIterable<FileMetadata>;

List files under a prefix href.

Parameters ​

prefix ​

string

Absolute href prefix ending with /, or "" to list everything.

listOptions ​

ListOptions

Pagination options

Returns ​

AsyncIterable<FileMetadata>

Implementation of ​

DiskDriver.list


metadata() ​

ts
metadata(href, options): Promise<
  | FileMetadata
| null>;

Get file metadata without content

Parameters ​

href ​

string

Absolute URL/URI with protocol

options ​
signal? ​

AbortSignal

Returns ​

Promise< | FileMetadata | null>

Implementation of ​

DiskDriver.metadata


move() ​

ts
move(
   from, 
   to, 
options): Promise<void>;

Move a file to a new location

Parameters ​

from ​

string

Source absolute URL/URI

to ​

string

Destination absolute URL/URI

options ​
signal? ​

AbortSignal

Returns ​

Promise<void>

Implementation of ​

DiskDriver.move


put() ​

ts
put(
   href, 
   stream, 
putOptions): Promise<FileMetadata>;

Store data from a ReadableStream

Parameters ​

href ​

string

Absolute URL/URI with protocol

stream ​

ReadableStream<Uint8Array<ArrayBufferLike>>

ReadableStream of data to store

putOptions ​

PutOptions

Optional metadata and content type

Returns ​

Promise<FileMetadata>

FileMetadata about the stored file

Implementation of ​

DiskDriver.put


storageInfo() ​

ts
storageInfo(): Promise<StorageInfo>;

Returns ​

Promise<StorageInfo>


url() ​

ts
url(href, _urlOptions?): Promise<string>;

Generate a URL for the file

Parameters ​

href ​

string

Absolute URL/URI with protocol

_urlOptions? ​

UrlOptions

URL options (expiration, download disposition)

Returns ​

Promise<string>

Implementation of ​

DiskDriver.url


watch() ​

ts
watch(pattern, options?): Promise<FSWatcher>;

Watch files for changes using chokidar

Parameters ​

pattern ​

string

options? ​

WatchOptions

Returns ​

Promise<FSWatcher>

Implementation of ​

DiskDriver.watch