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


TypeScript fs.mkdtempSync函数代码示例

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


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

示例1: getNewLogDirectory

	public async getNewLogDirectory(): Promise<string | undefined> {
		const root = await this.context.logger.logDirectory;
		try {
			return fs.mkdtempSync(path.join(root, `tsserver-log-`));
		} catch (e) {
			return undefined;
		}
	}
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:8,代码来源:logDirectoryProvider.ts

示例2: getNewLogDirectory

	public async getNewLogDirectory(): Promise<string | undefined> {
		const root = this.logDirectory();
		if (root) {
			try {
				return fs.mkdtempSync(path.join(root, `tsserver-log-`));
			} catch (e) {
				return undefined;
			}
		}
		return undefined;
	}
开发者ID:developers23,项目名称:vscode,代码行数:11,代码来源:logDirectoryProvider.ts

示例3: copyServiceFilesToTempFolder

// On some distributions, root is not allowed access the AppImage folder: copy the files to /tmp.
function copyServiceFilesToTempFolder() {
  const tmp = fs.mkdtempSync('/tmp/');
  console.log(`copying service files to ${tmp}`);
  [LINUX_DAEMON_FILENAME, LINUX_DAEMON_SYSTEMD_SERVICE_FILENAME, LINUX_INSTALLER_FILENAME].forEach(
      (filename) => {
        const src = path.join(OUTLINE_PROXY_CONTROLLER_PATH, filename);
        // https://github.com/jprichardson/node-fs-extra/issues/323
        const dest = path.join(tmp, filename);
        fsextra.copySync(src, dest, {overwrite: true});
      });
  return tmp;
}
开发者ID:hlyu368,项目名称:outline-client,代码行数:13,代码来源:util.ts

示例4: createTestServerOption

export function createTestServerOption() {
  const tmpDataPath = fs.mkdtempSync(path.join(os.tmpdir(), 'code_test'));

  const config = {
    get(key: string) {
      if (key === 'path.data') {
        return tmpDataPath;
      }
    },
  };

  return new ServerOptions(TEST_OPTIONS, config);
}
开发者ID:elastic,项目名称:kibana,代码行数:13,代码来源:test_utils.ts

示例5: getPypircPath

export function getPypircPath(): string {
    let pypircPath: string;
    if (tl.getVariable("PYPIRC_PATH")) {
        pypircPath = tl.getVariable("PYPIRC_PATH");
    }
    else {
       let tempPath = tl.getVariable("Agent.TempDirectory");
       tempPath = path.join(tempPath, "twineAuthenticate");
       tl.mkdirP(tempPath);
       let savePypircPath = fs.mkdtempSync(tempPath + path.sep);
       pypircPath = savePypircPath + path.sep + ".pypirc";
    }
    return pypircPath;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:14,代码来源:utilities.ts

示例6: getPypircPath

export function getPypircPath(): string {
    let pypircPath: string;
    if (tl.getVariable("PYPIRC_PATH")) {
        pypircPath = tl.getVariable("PYPIRC_PATH");
    }
    else {
       // tslint:disable-next-line:max-line-length
       let tempPath = tl.getVariable("Agent.BuildDirectory") || tl.getVariable("Agent.ReleaseDirectory") || process.cwd();
       tempPath = path.join(tempPath, "twineAuthenticate");
       tl.mkdirP(tempPath);
       let savePypircPath = fs.mkdtempSync(tempPath + path.sep);
       pypircPath = savePypircPath + path.sep + ".pypirc";
    }
    return pypircPath;
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:15,代码来源:utilities.ts

示例7: zipLogs

function zipLogs(
	logsPath: string
): Promise<string> {
	const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-log-upload'));
	const outZip = path.join(tempDir, 'logs.zip');
	return new Promise<string>((resolve, reject) => {
		doZip(logsPath, outZip, tempDir, (err, stdout, stderr) => {
			if (err) {
				console.error(localize('zipError', 'Error zipping logs: {0}', err.message));
				reject(err);
			} else {
				resolve(outZip);
			}
		});
	});
}
开发者ID:eamodio,项目名称:vscode,代码行数:16,代码来源:logUploader.ts

示例8: start

 public static start() : EtcdDaemon {
   let ret = new EtcdDaemon();
   ret.etcdir = fs.mkdtempSync("certor-test-")
   console.log("CREATED:", ret.etcdir)
   ret.etcd = cp.spawn('etcd', ['--data-dir', ret.etcdir])
   ret.etcd.on('error', (err) => {
     console.error("can't spawn etcd")
   });
   ret.etcd.stdin.on('data', (res: string) => {
   //console.log(">>"+res+"<<")
   })
   ret.etcd.stderr.on('data', (res: string) => {
   // console.log(">>"+res+"<<")
   })
   // WAIT FOR started
   return ret;
 }
开发者ID:protonet,项目名称:certor,代码行数:17,代码来源:etcd_daemon.ts

示例9: describe

describe('repository service test', () => {
  const log = new ConsoleLogger();
  const baseDir = fs.mkdtempSync(path.join(os.tmpdir(), 'code_test'));
  log.debug(baseDir);
  const repoDir = path.join(baseDir, 'repo');
  const credsDir = path.join(baseDir, 'credentials');
  // @ts-ignore
  before(() => {
    fs.mkdirSync(credsDir);
    fs.mkdirSync(repoDir);
  });
  // @ts-ignore
  after(() => {
    return rimraf.sync(baseDir);
  });
  const service = new RepositoryService(repoDir, credsDir, log, false /* enableGitCertCheck */);

  it('can not clone a repo by ssh without a key', async () => {
    const repo = RepositoryUtils.buildRepository(
      'git@github.com:elastic/TypeScript-Node-Starter.git'
    );
    await assert.rejects(service.clone(repo));
    // @ts-ignore
  }).timeout(60000);

  /* it('can clone a repo by ssh with a key', async () => {

    const repo = RepositoryUtils.buildRepository('git@github.com:elastic/code.git');
     const { publicKey, privateKey } = generateKeyPairSync('rsa', {
      modulusLength: 4096,
      publicKeyEncoding: {
        type: 'pkcs1',
        format: 'pem',
      },
      privateKeyEncoding: {
        type: 'pkcs1',
        format: 'pem',
      },
    });
    fs.writeFileSync(path.join(credsDir, 'id_rsa.pub'), publicKey);
    fs.writeFileSync(path.join(credsDir, 'id_rsa'), privateKey);
    const result = await service.clone(repo);
    assert.ok(fs.existsSync(path.join(repoDir, result.repo.uri)));
  }).timeout(60000); */
});
开发者ID:elastic,项目名称:kibana,代码行数:45,代码来源:repository_service.ts

示例10: Promise

    return new Promise((resolve, reject) => {
      this.workingDir = fs.mkdtempSync(path.join(os.tmpdir(), "e2e-app"))

      try {
        if (fs.statSync(this.path).isDirectory()) {
          for (const file of fs.readdirSync(this.path)) {
            const src = path.join(this.path, file)
            const dst = path.join(this.workingDir, file)
            console.debug(`Copy file ${src} => ${dst}`)
            fs.copyFileSync(src, dst)
          }
        } else {
          const dst = path.join(this.workingDir, `index${path.extname(this.path)}`)
          console.debug(`Copy file ${this.path} => ${dst}`)
          fs.copyFileSync(this.path, dst)
        }
      } catch (err) {
        console.warn(err)
        reject(new Error("Error copying test app: " + err.toString()))
      }

      this.child = execa("../../fly", ["server", "-p", this.port.toString(), "--no-watch", this.workingDir], {
        env: {
          LOG_LEVEL: process.env.LOG_LEVEL,
          FLY_ENV: "test",
          HOST_ALIASES: JSON.stringify(aliasMap)
        }
      })
      // this.child.on("exit", (code, signal) => {
      //   console.debug(`[${this.alias}] exit from signal ${signal}`, { code })
      // })
      this.child.on("error", err => {
        console.warn(`[${this.alias}] process error`, { err })
      })
      this.child.stdout.on("data", chunk => {
        console.debug(`[${this.alias}] ${chunk}`)
      })

      waitOn({ resources: [`tcp:${this.context.hostname}:${this.port}`], timeout: 10000 }).then(resolve, reject)
    })
开发者ID:dianpeng,项目名称:fly,代码行数:40,代码来源:EdgeContext.ts


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