当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fs-extra.mkdir函数代码示例

本文整理汇总了TypeScript中fs-extra.mkdir函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mkdir函数的具体用法?TypeScript mkdir怎么用?TypeScript mkdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mkdir函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: prepareTargetDir

async function prepareTargetDir(
	bundle: boolean,
	separateBuildDir: boolean
): Promise<TargetPaths> {

	let targetDir = path.join(os.tmpdir(), `vscode-firefox-debug-test-${uuid.v4()}`);
	await fs.mkdir(targetDir);
	let scriptTags = bundle ? ['bundle.js'] : ['f.min.js', 'g.min.js'];

	if (!separateBuildDir) {

		await sourceMapUtil.copyFiles(TESTDATA_PATH, targetDir, ['index.html', 'f.js', 'g.js']);
		await sourceMapUtil.injectScriptTags(targetDir, scriptTags);

		return { targetDir, srcDir: targetDir, buildDir: targetDir };

	} else {

		let srcDir = path.join(targetDir, 'src');
		await fs.mkdir(srcDir);
		let buildDir = path.join(targetDir, 'build');
		await fs.mkdir(buildDir);

		await sourceMapUtil.copyFiles(TESTDATA_PATH, srcDir, ['f.js', 'g.js']);
		await sourceMapUtil.copyFiles(TESTDATA_PATH, buildDir, ['index.html']);
		await sourceMapUtil.injectScriptTags(buildDir, scriptTags);

		return { targetDir, srcDir, buildDir };
	}
}
开发者ID:hbenl,项目名称:vscode-firefox-debug,代码行数:30,代码来源:testGulpSourceMaps.ts

示例2: before

 before(async () => {
   await ensureTestDirIsNonexistent();
   await fs.mkdir(dir);
   execSync(`${nodeInstaller} init -y`, {
     cwd: dir,
   });
 });
开发者ID:balloonzzq,项目名称:electron-forge,代码行数:7,代码来源:api_spec_slow.ts

示例3: Promise

 return new Promise((resolve, reject) => {
   fs.mkdir(p, err => {
     if (!err) {
       locks[p] = 1
       fs.writeFile(pidPath, process.pid.toString(), resolve)
       return
     }
     if (err.code !== 'EEXIST') return reject(err)
     lockActive(pidPath)
       .then(active => {
         if (!active)
           return unlock(p)
             .then(resolve as any)
             .catch(reject)
         if (timeout <= 0) throw new Error(`${p} is locked`)
         debug(`locking ${p} ${timeout / 1000}s...`)
         wait(1000).then(() =>
           lock(p, timeout - 1000)
             .then(resolve)
             .catch(reject),
         )
       })
       .catch(reject)
   })
 })
开发者ID:dhruvcodeword,项目名称:prisma,代码行数:25,代码来源:rwlockfile.ts

示例4: getNewPath

    getNewPath('Enter a new folder name', data.cwd, newPath => {
        fs.mkdir(newPath, err => {
            if (codeFileNav.checkError(err)) { return; }

            codeFileNav.showFileList();
        });
    });
开发者ID:jakelucas,项目名称:code-file-nav,代码行数:7,代码来源:commands.ts

示例5: checkEnv

  async checkEnv () {
    this.emit('progress', 'checkJava')
    await this._checkJava()
    this.emit('progress', 'cleanNatives')
    await this._cleanNatives()
    this._arguments.push(`-Djava.library.path=${this._nativesPath}`)
    this.emit('progress', 'resolveLibraries')
    await this._setupLibraries()
    this.emit('progress', 'resolveNatives')
    await fs.mkdir(this._nativesPath)
    await this._setupNatives()
    if (this._missingLibrary.length !== 0) {
      this.emit('missing_all', this._missingLibrary)
      let err = new Error('missing library')
      err['missing'] = this._missingLibrary
      err['launcher'] = this
      throw err
    }

    await fs.ensureDir(this._gameDirectory)
    this.emit('progress', 'mergeArguments')
    this._arguments.push(this.opts.json['mainClass'])
    this._mcArguments()
    this.emit('progress', 'envOK')
  }
开发者ID:bangbang93,项目名称:BMCLJS,代码行数:25,代码来源:launcher.ts

示例6: reject

 return new Promise<void>((resolve, reject) => {
   Fs.mkdir(directoryPath, err => {
     if (err && err.code !== 'EEXIST') {
       reject(err)
       return
     }
     resolve()
   })
 })
开发者ID:tamdao,项目名称:desktop,代码行数:9,代码来源:file-system.ts

示例7: it

    it('should return an absolute path when run inside a working directory', async () => {
      const result = await getTopLevelWorkingDirectory(repository!.path)
      expect(result).to.equal(repository!.path)

      const subdirPath = path.join(repository!.path, 'subdir')
      await FSE.mkdir(subdirPath)

      const subDirResult = await getTopLevelWorkingDirectory(repository!.path)
      expect(subDirResult).to.equal(repository!.path)
    })
开发者ID:ghmoore,项目名称:desktop,代码行数:10,代码来源:rev-parse-test.ts

示例8:

			return new this.$q<Models.IFolder>((resolve, reject) => {
				var folderPath = nodeJsPath.join(folder.path, name);
				nodeFs.mkdir(folderPath, (err) => {
					if (err) {
						reject(err);
					}
					else {
						resolve(new Models.NodeFolder(folderPath, folder));
					}
				});
			});
开发者ID:bihai,项目名称:Notedown,代码行数:11,代码来源:FolderService.ts

示例9: Before

Before(async function() {
  this.rootDir = path.join(process.cwd(), 'tmp')
  let rootDirExists = false
  try {
    await fs.stat(this.rootDir)
    rootDirExists = true
  } catch (e) {
    // nothing to do here
  }
  if (rootDirExists) {
    rimraf.sync(this.rootDir)
  }
  await fs.mkdir(this.rootDir)
})
开发者ID:Originate,项目名称:tutorial-runner,代码行数:14,代码来源:env.ts

示例10: logFile

/**
 * Determine the location of the log file based on the operating system
 * and return as an absolute string from os.homedir()
 *
 * @returns {string} Path to log file
 **/
async function logFile () {
	
	const homeDir : string = os.homedir();
	const linuxDir : string = `/.config/mcopy/`;
	const macDir : string = `/Library/Logs/mcopy/`;
	const winDir : string = `/AppData/Roaming/mcopy/`;
	let logPath : string = path.join(homeDir, linuxDir);
	let exists : boolean;

	if (process.platform === 'darwin') {
		logPath = path.join(homeDir, macDir);
	} else if (process.platform === 'win32') {
		logPath = path.join(homeDir, winDir);
	}
	exists = await fs.exists(logPath);
	if (!exists) {
		await fs.mkdir(logPath);
	}
	return path.join(logPath, 'mcopy.log');
}
开发者ID:sixteenmillimeter,项目名称:mcopy,代码行数:26,代码来源:index.ts


注:本文中的fs-extra.mkdir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。