How to use the fs.unlinkSync function in fs

To help you get started, we’ve selected a few fs 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 grncdr / node-any-db / test / helpers.js View on Github external
testOpts.drivers.forEach(function (driver) {
      if (driver == 'sqlite3') {
        try { fs.unlinkSync(sqliteFilename) } catch (e) {}
      }
      t.test(driver, function (t) {
        callback(databaseUrls[driver], t)
      })
    })
  })
github mmoulton / grunt-mocha-cov / test / mocha.js View on Github external
}, function (error) {
      should.not.exist(error);
      var filename = path.resolve('test/new/out.json'),
          dir = path.dirname(filename);
      var jsonOutput = JSON.parse(fs.readFileSync(filename));
      fs.unlinkSync(filename);
      fs.rmdirSync(dir);
      jsonOutput.coverage.should.equals(100);
      done();
    });
  });
github style-tools / async / test / specs / chrome-headless-tests.js View on Github external
iife_files.forEach(function(file) {
                fs.unlinkSync(file);
            });
github Mogztter / asciidoctor-pdf.js / test / helper.js View on Github external
      tmpFiles.forEach((file) => fs.unlinkSync(file))
    }
github WPO-Foundation / webpagetest / agent / js / src / agent_main.js View on Github external
job.zipResultFiles['timed_events.json'] = JSON.stringify(ipcMsg.userTimingMarks);
    if (ipcMsg.pageData)
      job.zipResultFiles['page_data.json'] = JSON.stringify(ipcMsg.pageData);
    if (ipcMsg.netlogFile)
      job.zipResultFiles['netlog.txt'] = fs.readFileSync(ipcMsg.netlogFile, "utf8");
    if (ipcMsg.histogramFile) {
      try {
        var buffer = fs.readFileSync(ipcMsg.histogramFile);
        if (buffer) {
          job.resultFiles.push(new wpt_client.ResultFile(
              wpt_client.ResultFile.ResultType.IMAGE,
              'histograms.json.gz',
              'text/plain',
              buffer));
        }
        fs.unlinkSync(ipcMsg.histogramFile);
      } catch(e) {}
    }
    if (ipcMsg.traceFile) {
      try {
        var buffer = fs.readFileSync(ipcMsg.traceFile);
        if (buffer) {
          job.resultFiles.push(new wpt_client.ResultFile(
              wpt_client.ResultFile.ResultType.GZIP,
              'trace.json.gz', 'application/x-gzip', buffer));
        }
        fs.unlinkSync(ipcMsg.traceFile);
      } catch(e) {}
    }
    if (ipcMsg.lighthouseFile) {
      try {
        var buffer = fs.readFileSync(ipcMsg.lighthouseFile);
github microsoft / vscode / extensions / postinstall.js View on Github external
function removeFile(filePath) {
	try {
		fs.unlinkSync(filePath);
		console.log(`removed '${filePath}'`);
	} catch (e) {
		console.warn(e);
	}
}
github vagnervjs / frame-player / converter / nodejs / app.js View on Github external
fs.readdirSync(tempDirName).map(function(elem, index){
            fs.unlinkSync(path.resolve(tempDirName, elem));
        });
    })
github aarondrabeck / zVirtualScenes / Plugins / HttpAPI / zvsMobile / sdk / command / src / module / Application.js View on Github external
this.resolve(appUrl, null, function(dependencies) {
            this.info("Found " + dependencies.length + " dependencies. Concatenating all into '" + appJs + "'");

            files = dependencies.map(function(dependency) {
                return path.join(src, dependency.path);
            });

            files.push(appJs);

            fs.concat(files, appJs + '.' + temp, "\n");

            nodeFs.unlinkSync(appJs);
            nodeFs.renameSync(appJs + '.' + temp, appJs);

            processedAssetsCount = 0;
            assetsCount = assets.length;
            assets.forEach(function(asset) {
                file = asset.path;
                destinationFile = path.join(destination, file);

                if (asset.type == 'js') {
                    fs.write(destinationFile, preprocessor.process(destinationFile));
                    this.info("Processed " + file);
                }

                if (environment == 'testing') {
                    return;
                }
github evolus / pencil / app / pencil-core / common / controller.js View on Github external
page.children[i].parentPage = parentPage;
                page.children[i].parentPageId = parentPage.id;
                parentPage.children.push(page.children[i]);
            } else {
                page.children[i].parentPage = null;
                page.children[i].parentPageId = null;
            }
        }
    }

    //Delete page from List pages
    var i = this.doc.pages.indexOf(page);
    this.doc.pages.splice(i, 1);

    fs.unlinkSync(page.tempFilePath);
    if (page.thumbPath && fs.existsSync(page.thumbPath)) fs.unlinkSync(page.thumbPath);

    var refPages = [];
    for (var i in this.doc.pages) {
        if (this.doc.pages[i].backgroundPageId == page.id) {
            refPages.push(this.doc.pages[i]);
        }
    }

    if (refPages.length > 0) {
        var thiz = this;
        function updateBackgroundPage(pages, backgroundPage) {
            pages.forEach(function (page) {
                if (backgroundPage) {
                    page.backgroundPage = backgroundPage;
                    page.backgroundPageId = backgroundPage.id;
                } else {
github html-next / ember-cli-changelog / lib / helpers / prompt-file-overwrite.js View on Github external
.then(function(status) {
      if (status.action === 'overwrite') {
        fs.writeFileSync(files.originalPath, fs.readFileSync(files.tmpPath));
      }
      fs.unlinkSync(files.tmpPath);
      return status;
    });
};

fs

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.

ISC
Latest version published 8 years ago

Package Health Score

67 / 100
Full package analysis