Files
notification-elements-demo/node_modules/@jsonjoy.com/fs-node-to-fsa/lib/NodeFileSystemWritableFileStream.d.ts
Giuliano Silvestro 5d0c9ec7eb Initial commit: notification-elements-demo app
Interactive Angular 19 demo for @sda/notification-elements-ui with
6 sections: Bell & Feed, Notification Center, Inbox, Comments &
Threads, Mention Input, and Full-Featured layout. Includes mock
data, dark mode toggle, and real-time event log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:49:19 +10:00

57 lines
2.5 KiB
TypeScript

import type { Data, FileSystemWritableFileStreamParams, IFileSystemWritableFileStream } from '@jsonjoy.com/fs-fsa';
import type { IFileHandle } from '@jsonjoy.com/fs-node-utils/lib/types/misc';
import type { NodeFsaFs, NodeFsaContext } from './types';
/**
* When Chrome writes to the file, it creates a copy of the file with extension
* `.crswap` and then replaces the original file with the copy only when the
* `close()` method is called. If the `abort()` method is called, the `.crswap`
* file is deleted.
*
* If a file name with with extension `.crswap` is already taken, it
* creates a new swap file with extension `.1.crswap` and so on.
*/
export declare const createSwapFile: (fs: NodeFsaFs, path: string, keepExistingData: boolean) => Promise<[handle: IFileHandle, path: string]>;
interface SwapFile {
/** Swap file full path name. */
path: string;
/** Seek offset in the file. */
offset: number;
/** Node.js open FileHandle. */
handle?: IFileHandle;
/** Resolves when swap file is ready for operations. */
ready?: Promise<void>;
}
declare const WS: typeof WritableStream;
/**
* Is a WritableStream object with additional convenience methods, which
* operates on a single file on disk. The interface is accessed through the
* `FileSystemFileHandle.createWritable()` method.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream
*/
export declare class NodeFileSystemWritableFileStream extends WS implements IFileSystemWritableFileStream {
protected readonly fs: NodeFsaFs;
protected readonly path: string;
protected readonly ctx: NodeFsaContext;
protected readonly swap: SwapFile;
constructor(fs: NodeFsaFs, path: string, keepExistingData: boolean, ctx: NodeFsaContext);
/**
* @sse https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/seek
* @param position An `unsigned long` describing the byte position from the top
* (beginning) of the file.
*/
seek(position: number): Promise<void>;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/truncate
* @param size An `unsigned long` of the amount of bytes to resize the stream to.
*/
truncate(size: number): Promise<void>;
protected writeBase(chunk: Data): Promise<void>;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write
*/
write(chunk: Data): Promise<void>;
write(params: FileSystemWritableFileStreamParams): Promise<void>;
}
export {};