UNPKG

@aurios/jason

Version:

A simple, lightweight, and embeddable JSON document database built on Bun.

21 lines (20 loc) 783 B
export default class Writer { #private; /** * Constructs a new Writer instance. * @param basePath The path to the file to write to. */ constructor(basePath: string); /** * Writes data to a file with the given filename. * * If the file is currently being written to, the data is queued to be written * once the current write operation completes. Ensures that writes are * performed atomically and handles concurrent write requests by queuing them. * * @param fileName - The name of the file to write to. * @param data - The data to be written to the file. * @returns A promise that resolves to true when the write operation is complete. */ write(fileName: string, data: string): Promise<boolean>; }