From 173eafe746e1fe3a847e9935c762448d18a44c40 Mon Sep 17 00:00:00 2001 From: Hexagon Date: Wed, 27 Mar 2024 22:03:12 +0100 Subject: [PATCH] Docs --- .github/workflows/test.yml | 4 +-- README.md | 74 ++++++++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6331065..477066c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,9 +13,9 @@ jobs: bun_ci: uses: cross-org/workflows/.github/workflows/bun-ci.yml@main with: - jsr_dependencies: "@cross/test @std/assert @cross/runtime @std/path @cross/dir @std/uuid/" + jsr_dependencies: "@cross/test @std/assert @cross/runtime @std/path @cross/dir @std/uuid" node_ci: uses: cross-org/workflows/.github/workflows/node-ci.yml@main with: - jsr_dependencies: "@cross/test @std/assert @cross/runtime @std/path @cross/dir @std/uuid/" + jsr_dependencies: "@cross/test @std/assert @cross/runtime @std/path @cross/dir @std/uuid" test_target: "src/**/*.test.ts" \ No newline at end of file diff --git a/README.md b/README.md index cbd0d46..4663e6d 100644 --- a/README.md +++ b/README.md @@ -9,21 +9,59 @@ will cover most scenarios, this library focuses on the file system operations. **Note:** This is work in progress. -## Coverage - -| Module | Method | Deno | Node | Bun | Browser (LocalStorage) | -| ------ | ---------- | ---- | ---- | --- | ---------------------- | -| stat | stat | X | X | X | | -| stat | exists | X | X | X | | -| stat | isDir | X | X | X | | -| stat | isFile | X | X | X | | -| stat | isSymlink | X | X | X | | -| ------ | ---------- | ---- | ---- | --- | ---------------------- | -| io | readFile | X | X | X | | -| io | writeFile | X | X | X | | -| ------ | ---------- | ---- | ---- | --- | ---------------------- | -| ops | unlink | X | X | X | | -| ops | mkdir | X | X | X | | -| ops | mktempdir | X | X | X | | -| ops | rmdir | X | X | X | | -| ------ | ---------- | ---- | ---- | --- | ---------------------- | +## Modules + +### Stat + +Example: + +``` +import { exists } from "@cross/fs/stat"; + +console.log(await exists("my/file")); +// -> true / false +``` + +Methods: + +| Method | Deno | Node | Bun | Browser (LocalStorage) | +| --------- | ---- | ---- | --- | ---------------------- | +| stat | X | X | X | | +| exists | X | X | X | | +| isDir | X | X | X | | +| isFile | X | X | X | | +| isSymlink | X | X | X | | + +### Io + +Example: + +``` +import { readFile } from "@cross/fs/io"; + +console.log(await readFile("my/file")); +// -> My file content +``` + +| Method | Deno | Node | Bun | Browser (LocalStorage) | +| --------- | ---- | ---- | --- | ---------------------- | +| readFile | X | X | X | | +| writeFile | X | X | X | | + +### Ops + +Example: + +``` +import { mktempdir } from "@cross/fs/ops"; + +console.log(await mktempdir("my-prefix")); +// -> /tmp/my-prefix-7a8s78-as67d6as6-asd67a6sd-asdyda/ +``` + +| Method | Deno | Node | Bun | Browser (LocalStorage) | +| ---------- | ---- | ---- | --- | ---------------------- | +| unlink | X | X | X | | +| mkdir | X | X | X | | +| mktempdir | X | X | X | | +| rmdir | X | X | X | |