Module tachyon-drive-node-fs
tachyon-drive-node-fs

NodeFS File Storage Driver for Tachyon Drive and Tachyon Drive Crypto processor
Initialize simple JSON file storage driver
const driver = new FileStorageDriver(
"FileStorageDriver",
"./store.json",
bufferSerializer,
);
Initialize crypt processor with JSON file storage driver
const processor = new CryptoBufferProcessor(Buffer.from("some-secret-key"));
const driver = new FileStorageDriver(
{
name: "FileStorageDriver",
fileName: "./store.json.aes",
logger: console,
},
bufferSerializer,
processor,
);
Example usage of local notification file updates when running multiple process on same host
const fileUpdateNotify = new FileUpdateNotify("./store.notify");
const driver = new SomeDriver(
{ name: "SomeDriverWithoutUpdateNotification" },
bufferSerializer,
fileUpdateNotify,
);
// includes common strToBufferSerializer
const jsonSerialization: IPersistSerializer<Data, string> = {
deserialize: (buffer: string) => JSON.parse(buffer.toString()),
serialize: (data: Data) => JSON.stringify(data),
validator: (data: Data) => dataSchema.safeParse(data).success,
};
const bufferSerializer: IPersistSerializer<Data, Buffer> = nextSerializer<
Data,
string,
Buffer
>(jsonSerialization, strToBufferSerializer);
Classes
- CryptoBufferProcessor
- FileStorageDriver
- FileUpdateNotify
Type Aliases
- FileStorageDriverOptions
Variables
- strToBufferSerializer