Skip to main content

Built and signed on GitHub Actions

Library to write out the contents of a JavaScript object structure to the file system in a granular directory structure.

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
2 months ago (0.1.4)
v
Handlers

The default handler builder for the library -- imlements the HandlerBuilder interface for a convenient way to create storage handlers.

f
storeObjectToDirectory

Convenience wrapper around the handler builder in Handlers and the ValueStorageHandler.storeValue directory storage handler method to write the contents of an object to a directory in one step.

factories

The functions in this module are the lower-level implementation details of the public API. They allow advanced consumers to control precisely how the library interacts with the file system or provide their own file system-like implementations.

c
DefaultHandlerBuilder

An implementation of interface HandlerBuilder that provides default versions of the known value storage handlers.

f
newDirectoryCreator

Create a new directory creator that can create local directories on the current platform.

f
newFileWriter

Create a new file writer appropriate for writing local files on the current platform.

interfaces

The interfaces that underlie this library.

I
ArrayToDirectoryHandlerOptions

Options that apply specifically to the array to directory builder method: HandlerBuilder.arrayToDirectory.

T
CanStoreValueFunc

The signature expected of the custom canStoreValue implementation passed to the HandlerBuilder.customFile method.

I
CustomFileValueHandlerOptions

Options specific to the HandlerBuilder.customFile method.

I
DirectoryCreator

Interface of a directory creator, that can asynchronously create a new directory.

I
DirectoryCreatorOptions

Options passed to the DirectoryCreator createDirectory method.

I
FileValueHandlerOptions

The common options passed to the file handler builder methods on interface HandlerBuilder.

I
FileWriter

Interface of a writer that can write text files from strings and Uint8Arrays to the file system.

I
HandlerBuilder

A fluent builder interface for creating value storage handlers handlers.

I
JsonFileValueHandlerOptions

The specific options for the HandlerBuilder.jsonFile method.

I
ObjectToDirectoryHandlerOptions

Options that apply to the directory-related builder methods: HandlerBuilder.arrayToDirectory and HandlerBuilder.objectToDirectory.

T
StringifyFunc

The signature expected of serializer functions passed to the HandlerBuilder.customFile method.

I
ValueStorageHandler

Interface implemented by objects that can store values to files or directories.

I
ValueStorageHandlerOptions

Options passed to the ValueStorageHandler storeValueToFile method.

I
WithOptionalSignal

Our own equivalent to the Node.js Abortable interface. Unfortunately, the Deno and Node.js AbortSignal types aren't completely identical, so using Abortable directly causes type checking issues.

I
WriteBinaryToFileOptions

Options passed to the FileWriter writeBinaryToFile method.

I
WriteTextToFileOptions

Options passed to the FileWriter writeTextToFile method.

utility

Some utility functions useful in advanced library usage scenarios.

f
decodePathElement

Perform the reverse of encodePathElement: decode a path element back to its original form.

f
encodePathElement

Encode a path element so that it does not contain any forward slashes (and can be decoded). This is a tiny subset of URI element encoding.

f
makeFluent

Given an object implementing interface ValueStorageHandler, wrap it in a FluentHandler implementation that makes it easier to build customized versions of the handler. The handler is only wrapped if it is not already a fluent handler.