Build and maintain your media library using the Chordinate Library Manager.
It's built on the SQLite Archive format, where a single SQLite database will act as a single-file container, wrapping both your files and their metadata.
See the official documentation for additional information.
const openLibrary = require('@chordinate/library');
// Creating and loading your library.
const myLibrary = openLibrary('/path/to/my-library.sqlar');
const { Buffer } = require('buffer');
const file = {
name: 'my-file.pro',
mode: 33188,
lastModified: new Date(),
size: 8, // contentsBuffer.byteLength;
contents: Buffer.from('Hello world!'),
};
// Add the file to your library.
// Or overwrite an existing one that has the same name.
await myLibrary.files.save(file);
// Reading a file from your library.
const file = await library.files.load('my-file.pro');
console.log(
file.contents.toString(), // 'Hello world!'
);
Data can also be extracted via the command line.
# List files in an existing archive
$ sqlite3 /path/to/my-library.sqlar -Atv
# Extract all ChordPro files from an existing archive
$ sqlite3 /path/to/my-library.sqlar -Ax *.pro
See the official documentation for an overview of the available commands and additional information.