From a6ec0bf631291590ec84a0f28b662f250a128418 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Tue, 17 Sep 2024 20:42:34 +0100 Subject: [PATCH] docs: `dir` was renamed to `path` a while back (#1060) --- docs/snapshot/index.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/snapshot/index.md b/docs/snapshot/index.md index e860d9858..d9541686e 100644 --- a/docs/snapshot/index.md +++ b/docs/snapshot/index.md @@ -30,15 +30,15 @@ import * as snapshot from 'memfs/lib/snapshot'; You can convert any folder of an `fs`-like file system into a POJO snapshot. ```ts -const snap = snapshot.toSnapshotSync({ fs, dir }); -const snap = await snapshot.toSnapshot({ fs: fs.promises, dir }); +const snap = snapshot.toSnapshotSync({ fs, path }); +const snap = await snapshot.toSnapshot({ fs: fs.promises, path }); ``` Then import it back from snapshot. ```ts -snapshot.fromSnapshotSync(snap, { fs, dir }); -await snapshot.fromSnapshot(snap, { fs: fs.promises, dir }); +snapshot.fromSnapshotSync(snap, { fs, path }); +await snapshot.fromSnapshot(snap, { fs: fs.promises, path }); ``` ## Binary snapshot @@ -47,15 +47,15 @@ Binary snapshots are encoded as CBOR `Uint8Array` buffers. You can convert any folder of an `fs`-like file system into a `Uint8Array` snapshot. ```ts -const uint8 = snapshot.toBinarySnapshotSync({ fs, dir }); -const uint8 = await snapshot.toBinarySnapshot({ fs: fs.promises, dir }); +const uint8 = snapshot.toBinarySnapshotSync({ fs, path }); +const uint8 = await snapshot.toBinarySnapshot({ fs: fs.promises, path }); ``` Then import it back from `Uint8Array` snapshot. ```ts -snapshot.fromBinarySnapshotSync(uint8, { fs, dir }); -await snapshot.fromBinarySnapshot(uint8, { fs: fs.promises, dir }); +snapshot.fromBinarySnapshotSync(uint8, { fs, path }); +await snapshot.fromBinarySnapshot(uint8, { fs: fs.promises, path }); ``` ## JSON snapshot @@ -67,15 +67,15 @@ data is encoded as Base64 data URL strings. The resulting JSON is returned as You can convert any folder of an `fs`-like file system into a `Uint8Array` snapshot. ```ts -const uint8 = snapshot.toJsonSnapshotSync({ fs, dir }); -const uint8 = await snapshot.toJsonSnapshot({ fs: fs.promises, dir }); +const uint8 = snapshot.toJsonSnapshotSync({ fs, path }); +const uint8 = await snapshot.toJsonSnapshot({ fs: fs.promises, path }); ``` Then import it back from `Uint8Array` snapshot. ```ts -snapshot.fromJsonSnapshotSync(uint8, { fs, dir }); -await snapshot.fromJsonSnapshot(uint8, { fs: fs.promises, dir }); +snapshot.fromJsonSnapshotSync(uint8, { fs, path }); +await snapshot.fromJsonSnapshot(uint8, { fs: fs.promises, path }); ``` ## Encoding format