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
3 months ago (0.1.4)

Some utility functions useful in advanced library usage scenarios.

The encodePathElement function implements the minimal subset of URI component encoding required to prevent issues when constructing paths in the source object. It encodes the "%" and "/" characters to prevent conflicts. The decodePathElement function implements the corresponding decoding.

The makeFluent function is a convenient way to "upgrade" a simple ValueStorageHandler implementation to the full FluentHandler interface by wrapping it in a fluent implementation. This is useful when implementing a value storage handler from scratch -- one can simply implement the core interface and use the library implementation of fluent handlers via a call to makeFluent.

Functions

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.

Add Package

deno add jsr:@scroogieboy/object-to-directory

Import symbol

import * as mod from "@scroogieboy/object-to-directory/utility";

---- OR ----

Import directly with a jsr specifier

import * as mod from "jsr:@scroogieboy/object-to-directory/utility";

Add Package

npx jsr add @scroogieboy/object-to-directory

Import symbol

import * as mod from "@scroogieboy/object-to-directory/utility";

Add Package

yarn dlx jsr add @scroogieboy/object-to-directory

Import symbol

import * as mod from "@scroogieboy/object-to-directory/utility";

Add Package

pnpm dlx jsr add @scroogieboy/object-to-directory

Import symbol

import * as mod from "@scroogieboy/object-to-directory/utility";

Add Package

bunx jsr add @scroogieboy/object-to-directory

Import symbol

import * as mod from "@scroogieboy/object-to-directory/utility";