How to use the fs-observable.readFileObservable function in fs-observable

To help you get started, we’ve selected a few fs-observable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nteract / nteract / applications / desktop / src / notebook / epics / loading.ts View on Github external
switchMap(action => {
      const filepath = action.payload.filepath;

      return forkJoin(
        readFileObservable(filepath),
        statObservable(filepath),
        // Project onto the Contents API response
        (content: Buffer, stat: fs.Stats): contents.IContent =>
          createContentsResponse(filepath, stat, content)
      ).pipe(
        // Timeout after one minute
        timeout(60 * 1000),
        map((model: contents.IContent<"notebook">) => {
          if (model.type !== "notebook") {
            throw new Error(
              "Attempted to load a non-notebook type from desktop"
            );
          }
          if (model.content === null) {
            throw new Error("No content loaded for notebook");
          }
github nteract / nteract / applications / desktop / src / main / index.ts View on Github external
mergeMap(() =>
    readFileObservable(nteractConfigFilename).pipe(
      catchError(err => {
        if (err.code === "ENOENT") {
          return writeFileObservable(
            nteractConfigFilename,
            JSON.stringify({
              theme: "light"
            })
          );
        }
        throw err;
      })
    )
  ),
github nteract / nteract / applications / desktop / src / notebook / epics / config.ts View on Github external
switchMap(() =>
      readFileObservable(CONFIG_FILE_PATH).pipe(
        map(data => actions.configLoaded(JSON.parse(data.toString())))
      )
    )

fs-observable

Observables for node fs

BSD-3-Clause
Latest version published 5 years ago

Package Health Score

63 / 100
Full package analysis