@kit-js/fs

2.1.0 • Public • Published

kit file system

file system meta protocol library, for managing directory trees as magical little file systems of their own.

Install it

npm install

Compile it

npm run compile

Examples

(include "kit/header")
(import-namespace kit)

(require! (lit File-system Directory File) "./index"
          'assert)
(var home (.load File-system "./") )
(var test-value "hello world")


(pipe (.set home  "./test.txt" test-value)
      (.then (aprint "test file set"))
      (.then (-> (.find home "test.txt")))
      (.then (aprint "file found, checking value"))
      (.then (#-> (get 'string)))
      (.then (=> (s)
                 (assert (= s test-value)
                         "file was not set with appropriate value"))))

same thing but the compiled js

var {FileSystem, Directory, File} = require("./index"),
    assert = require("assert");
var home = FileSystem.load("./");

var testValue = "hello world";

home.set("./test.txt", testValue)
    .then((function(b, ...others) {
        /* node_modules/kit/inc/console.sibilant:10:8 */

        console.log("test file set", b, ...others);
        return b;
    })).then((() => {

        return home.find("test.txt");

    })).then((function(b, ...others) {
        /* node_modules/kit/inc/console.sibilant:10:8 */

        console.log("file found, checking value", b, ...others);
        return b;
    })).then((function() {
        /* tests/base.sibilant:15:13 */

        return arguments[0].string;
    })).then(((s) => {

        return assert(s === testValue, "file was not set with appropriate value");

    }));

/@kit-js/fs/

    Package Sidebar

    Install

    npm i @kit-js/fs

    Weekly Downloads

    0

    Version

    2.1.0

    License

    none

    Unpacked Size

    100 kB

    Total Files

    36

    Last publish

    Collaborators

    • risuki