@stele-climbing/stele1-filesystem
v0.0.1
Published
filesystem interface for stele1 catalogs
Maintainers
Readme
@stele-climbing/stele1-filesystem
Filesystem interface for stele1 catalogs.
Reads and writes catalogs on disk using node's fs. Each catalog is a
directory; records are individual JSON files organized by datatype.
Exposes primitives: get, set, list, remove. Higher-level operations (queries, traversals, indexing) are left to consumers.
Use
const { Catalog } = require('@stele-climbing/stele1-filesystem');
const catalog = new Catalog('/path/to/catalog');
if (!catalog.exists()) catalog.create();
const uuids = catalog.climbUuids();
const climb = catalog.getClimbByUuid(uuids[0]);
climb.getName().toData(); // 'The Mandala'Each datatype (Climb, Area, Photo, Parking, Approach) has
matching {type}Uuids(), get{Type}ByUuid(uuid), set{Type}({type}),
and remove{Type}ByUuid(uuid) methods.
Photos additionally support getPhotoImageByUuid and setPhotoImageByUuid
for the associated image file.
See @stele-climbing/stele1-datatypes for the datatypes returned by the getters.
Install
npm install @stele-climbing/stele1-filesystemLicense
MIT
