How to use the fs-plus.writeFileSync function in fs-plus

To help you get started, we’ve selected a few fs-plus 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 atom / git-utils / spec / git-spec.js View on Github external
it('returns the status of only that path2', () => {
        fs.writeFileSync(filePath, '', 'utf8')

        const statuses = repo.getStatusForPaths(['dir/**'])
        expect(_.keys(statuses).length).toBe(0)
      })
    })
github atom / atom / spec / git-repository-spec.js View on Github external
it('gets the status based on the files inside the directory', () => {
      expect(
        repo.isStatusModified(repo.getDirectoryStatus(directoryPath))
      ).toBe(false);
      fs.writeFileSync(filePath, 'abc');
      repo.getPathStatus(filePath);
      expect(
        repo.isStatusModified(repo.getDirectoryStatus(directoryPath))
      ).toBe(true);
    });
  });
github atom / atom / spec / git-repository-spec.js View on Github external
it('trigger a status-changed event when the new status differs from the last cached one', () => {
      const statusHandler = jasmine.createSpy('statusHandler');
      repo.onDidChangeStatus(statusHandler);
      fs.writeFileSync(filePath, '');
      let status = repo.getPathStatus(filePath);
      expect(statusHandler.callCount).toBe(1);
      expect(statusHandler.argsForCall[0][0]).toEqual({
        path: filePath,
        pathStatus: status
      });

      fs.writeFileSync(filePath, 'abc');
      status = repo.getPathStatus(filePath);
      expect(statusHandler.callCount).toBe(1);
    });
  });
github atom / git-utils / spec / git-spec.js View on Github external
beforeEach(() => {
      repoDirectory = temp.mkdirSync('node-git-repo-')
      wrench.copyDirSyncRecursive(path.join(__dirname, 'fixtures/subdir.git'), path.join(repoDirectory, '.git'))
      repo = git.open(repoDirectory)

      const dir = path.join(repo.getWorkingDirectory(), 'dir')
      filePath = path.join(dir, 'a.txt')
      fs.writeFileSync(filePath, 'hey there', 'utf8')
    })
github microsoft / vscode-iot-workbench / src / Models / RaspberryPiYoctoDevice.ts View on Github external
generateYoctoConfig(folder: string) {
    const filePath = path.join(folder, LocalConstants.configFileName);
    if (!fs.existsSync(filePath)) {
      const config:
          RaspberryPiYoctoConfig = {output: LocalConstants.defaultOutputPath};
      fs.writeFileSync(filePath, JSON.stringify(config, null, 4));
    }
  }
}

fs-plus

node's fs with more helpers

MIT
Latest version published 5 years ago

Package Health Score

50 / 100
Full package analysis