How to use the fs.mkdirSync 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 librg / librg / scripts / build-pkg.js View on Github external
[ "zpl.c", "zpl.h" ],
    [ "zpl.c", "zpl_math.h" ],
]

const files = [
    'CMakeLists.txt',
    'LICENSE',
]

const pkg = './pkg/'
const pkg_includes = './pkg/librg/'

// recreate pkg dir
fs.rmdirSync(pkg)
fs.mkdirSync(pkg)
fs.mkdirSync(pkg_includes)

// copy header files
libs.map(lib => fs.copyFileSync(
    './node_modules/' + lib[0] + '/include/' + lib[1],
    pkg_includes + lib[1]
))

// copy librg
fs.copyFileSync('./include/librg.h', pkg_includes + 'librg.h')

// copy files else
files.map(file => fs.copyFileSync(file, pkg + file))
github nodeGame / nodegame / bin / nodegame-installer.js View on Github external
function copyGameFromNodeModules(game, enable) {
    enable = 'undefined' === typeof enable ? true : enable;
    let gameDir = path.resolve(GAMES_AVAILABLE_DIR, game);

    // Move game from node_modules into games_available directory.
    fs.renameSync(path.resolve(INSTALL_DIR_MODULES, game), gameDir);

    // Make sure that the test command works.
    let tmpPath = path.join(gameDir, 'node_modules');
    if (!fs.existsSync(tmpPath)) fs.mkdirSync(tmpPath);
    tmpPath = path.join(tmpPath, '.bin');
    if (!fs.existsSync(tmpPath)) fs.mkdirSync(tmpPath);
    tmpPath = path.join(tmpPath, 'mocha');
    if (!fs.existsSync(tmpPath)) {
        makeLink(path.join(INSTALL_DIR_MODULES, '.bin/mocha'), tmpPath);
    }

    if (!enable) return;

    // Enable it.
    makeLink(gameDir, path.resolve(GAMES_ENABLED_DIR, game));
}
github juliangruber / subfs / __tests__ / rmdir.js View on Github external
test('rmdir', function (done) {
  expect.assertions(2)
  var dir = join(
    os.tmpdir(),
    Math.random()
      .toString(16)
      .slice(2)
  )

  fs.mkdirSync(dir)
  fs.mkdirSync(join(dir, 'dir'))

  subfs({ dir, fs }).rmdir('dir', function (err) {
    expect(err).toBeFalsy()
    expect(fs.existsSync(join(dir, 'dir'))).toBeFalsy()

    done()
  })
})
github csiqueirasilva / PoEController / src / game / Configuration.js View on Github external
var fs = require('fs');
var Window = require('./Window');
var dir = process.env['APPDATA'] + '\\PoeController';

if (!fs.existsSync(dir)){
    fs.mkdirSync(dir);
	if(!fs.existsSync(dir)) {
		Window.quit('Could not create folder: ' + dir);
	}
}

module.exports = {
	DATA_PATH: dir
};
github jordwalke / FaxJs / projectManager / stockResources / BuildProject.js View on Github external
function build(buildSpecs) {
  var i, moduleName, moduleDesc, moduleMain, moduleMainPath;

  console.log("-> Creating New Build Directories");
  fs.mkdirSync(curDir + '/build/client', '0777');
  fs.mkdirSync(curDir + '/build/client/staticResources', '0777');
  fs.mkdirSync(curDir + '/build/client/buildLib', '0777');


  console.log('-> Copying project modules to build directory');

  for (moduleName in buildSpecs.projectConfig.projectModules) {
    if (buildSpecs.projectConfig.projectModules.hasOwnProperty(moduleName)) {
      moduleDesc = buildSpecs.projectConfig.projectModules[moduleName];
      moduleMain = moduleDesc.main;
      logAndThrowIf(moduleMain && (
          moduleMain.length < 6 || moduleMain.substr(0,2) !== './' ||
          moduleMain.substr(moduleMain.length-3) !== '.js'),
          'If a main module is specified (' + moduleMain + ') then it must begin with' +
          '"./" and end with ".js" indicating the file inside of lib/ModuleName');

      logAndThrowIf(buildSpecs.libDirContentsArr.indexOf(moduleName) === -1,
          'Cannot find a directory with module name ' + moduleName + ' in lib -' +
github edmand46 / webm_bot / src / index.js View on Github external
const start = async () => {
  await mongoose.connect(dbUrl, { useNewUrlParser: true });

  if (!fs.existsSync(dataFolder))
    fs.mkdirSync(dataFolder);

  console.log('started');
  bot.startPolling();
  await service();
};
github IBM-Cloud / skylink / web / app.js View on Github external
var classifierId = req.params.classifierId;
    var classifierClass = req.params.classifierClass;
    var currentTime = new Date().getTime()

    if (posneg == "positive" || posneg == "negative"){
        //console.log(id, posneg, classifierId, classifierClass)
        console.log("retraining")

        var rootDir = './temp';
        var dir = rootDir + "/" + currentTime;

        if (!fs.existsSync(rootDir)){
            fs.mkdirSync(rootDir);
        }
        if (!fs.existsSync(dir)){
            fs.mkdirSync(dir);
        }

        var tempFile = dir + "/" + id + ".jpg";
        var resizedFile = dir + "/" + id + "-resize.jpg";
        var zipFile = dir + "/" + id + ".zip";

        var cleanup = function() {
            console.log("cleanup");
            fs.unlink(tempFile, function (err) { })
            fs.unlink(resizedFile, function (err) { })
            fs.unlink(zipFile, function (err) { })
            fs.rmdir(dir, function (err) { })
        }

        db.attachment.get(id, "image.jpg", function(err, attachmentBody) {
            if (err) {
github mhlzr / html5-videoEditor / modules / manager.js View on Github external
db.files.remove({});
    db.assets.remove({});
    db.sequences.remove({});
    db.compositions.remove({});

    try {

        //remove the projects folder and it's content
        wrench.rmdirSyncRecursive(PROJECTS_PATH);

        //check if folder exists
        var exists = fs.existsSync(PROJECTS_PATH);

        //recreate the just removed dir
        if (!exists) {
            fs.mkdirSync(PROJECTS_PATH, parseInt('777', 8));
        }

        callback();
    }

    catch (e) {
        callback();
    }
};
github reruin / sharelist / app / plugins / drive.fs.js View on Github external
const mkdir = (p) => {
    if (fs.existsSync(p) == false) {
      mkdir(path.dirname(p));
      fs.mkdirSync(p);
    }
  };

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