當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。