• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: storeTestCoverage

/**
 * Stores the test coverage data before running the next test that would overwrite it
 */
async function storeTestCoverage() {
  const outputPath = path.join(process.cwd(), '.nyc_output')
  try {
    await fs.stat(outputPath)
  } catch (e) {
    return
  }
  await fs.move(outputPath, path.join(process.cwd(), '.nyc_output_cli', uuid()))
}
开发者ID:Originate,项目名称:tutorial-runner,代码行数:12,代码来源:world.ts


示例2: beforeEach

 beforeEach(async () => {
   makeStub.returns(fakeMake('darwin'));
   const dryPath = path.resolve(dir, 'out', 'publish-dry-run');
   await fs.mkdirs(dryPath);
   await fs.writeFile(path.resolve(dryPath, 'hash.json'), 'test');
   await publish({
     dir,
     interactive: false,
     dryRun: true,
   });
   expect(await fs.pathExists(path.resolve(dryPath, 'hash.json'))).to.equal(false, 'previous hashes should be erased');
   const backupDir = path.resolve(dir, 'out', 'backup');
   await fs.move(dryPath, backupDir);
   makeStub.returns(fakeMake('win32'));
   await publish({
     dir,
     interactive: false,
     dryRun: true,
   });
   for (const backedUp of await fs.readdir(backupDir)) {
     await fs.copy(path.resolve(backupDir, backedUp), path.resolve(dryPath, backedUp));
   }
 });
开发者ID:balloonzzq,项目名称:electron-forge,代码行数:23,代码来源:publish_spec.ts


示例3:

const uid = 0;
const gid = 0;
const fd = 0;
const modeNum = 0;
const modeStr = "";
const object = {};
const errorCallback = (err: Error) => { };
const readOptions: fs.ReadOptions = {
	reviver: {}
};
const writeOptions: fs.WriteOptions = {
	replacer: {}
};

fs.moveSync(src, dest, {});
fs.move(src, dest, {}).then(() => {
	// stub
});
fs.move(src, dest).then(() => {
	// stub
});
fs.move(src, dest, {}, () => {
	// stub
});
fs.move(src, dest, () => {
	// stub
});

fs.copy(src, dest).then(() => {
	// stub
});
开发者ID:gilamran,项目名称:DefinitelyTyped,代码行数:31,代码来源:fs-extra-tests.ts


示例4: moveDirectory

export function moveDirectory(from: string, to: string) {
  return fs.move(from, to, { overwrite: true });
}
开发者ID:DevIntent,项目名称:angular-cli,代码行数:3,代码来源:fs.ts


示例5: doWork

async function doWork() {
    try {
        tl.setResourcePath(path.join(__dirname, 'task.json'));

        const serverEndpoint: string = tl.getInput('serverEndpoint', true);
        const serverEndpointUrl: string = tl.getEndpointUrl(serverEndpoint, false);
        const username: string = tl.getEndpointAuthorizationParameter(serverEndpoint, 'username', false);
        const password: string = tl.getEndpointAuthorizationParameter(serverEndpoint, 'password', false);

        const jobName: string = tl.getInput('jobName', true);
        const localPathRoot: string = tl.getPathInput('saveTo', true);
        const itemPattern: string = tl.getInput('itemPattern', false) || "**";
        const strictSSL: boolean = ('true' !== tl.getEndpointDataParameter(serverEndpoint, 'acceptUntrustedCerts', true));

        let jenkinsClient: JenkinsRestClient = new JenkinsRestClient();
        let jenkinsJobDetails: JenkinsJobDetails;

        if (tl.getBoolInput('propagatedArtifacts') == true) {
            var artifactProvider = tl.getInput('artifactProvider');
            switch (artifactProvider.toLowerCase()) {
                case "azurestorage":
                    let azureDownloader = new AzureStorageArtifactDownloader(tl.getInput('ConnectedServiceNameARM', true),
                        tl.getInput('storageAccountName', true),
                        tl.getInput('containerName', true),
                        tl.getInput('commonVirtualPath', false));
                    await azureDownloader.downloadArtifacts(localPathRoot, tl.getInput('itemPattern', false) || "**");
                    break;
                default:
                    throw Error(tl.loc('ArtifactProviderNotSupported', artifactProvider));
            }
        }
        else {
            jenkinsJobDetails = await jenkinsClient.GetJobDetails();
            console.log(tl.loc("FoundJenkinsJobDetails", jenkinsJobDetails.jobName, jenkinsJobDetails.jobType, jenkinsJobDetails.buildId, jenkinsJobDetails.multiBranchPipelineName));

            const artifactQueryUrl: string = `${serverEndpointUrl}/${jenkinsJobDetails.jobUrlInfix}/${jenkinsJobDetails.multiBranchPipelineUrlInfix}/${jenkinsJobDetails.buildId}/api/json?tree=artifacts[*]`;
            var variables = {
                "endpoint": {
                    "url": serverEndpointUrl
                },
                "jobUrlInfix": jenkinsJobDetails.jobUrlInfix,
                "multibranchPipelineUrlInfix": jenkinsJobDetails.multiBranchPipelineUrlInfix,
                "version": jenkinsJobDetails.buildId
            };

            var handler = new handlers.BasicCredentialHandler(username, password);
            var hasArtifacts = await jenkinsClient.HasAssociatedArtifacts(artifactQueryUrl);

            if (hasArtifacts) {
                if (!itemPattern || itemPattern === '**') {
                    const archiveUrl: string = `${serverEndpointUrl}/${jenkinsJobDetails.jobUrlInfix}/${jenkinsJobDetails.multiBranchPipelineUrlInfix}/${jenkinsJobDetails.buildId}/artifact/*zip*/`
                    var zipLocation = path.join(localPathRoot, "archive.zip");
                    await getZipFromUrl(archiveUrl, strictSSL, zipLocation, handler);

                    var unzipPromise = unzip(zipLocation, localPathRoot);
                    unzipPromise.catch((error) => {
                        throw error;
                    });

                    await unzipPromise;

                    if (tl.exist(zipLocation)) {
                        tl.rmRF(zipLocation);
                    }

                    var archivePath = path.join(localPathRoot, "archive");
                    var tempPath = path.join(localPathRoot, uuidv4());
                    fsExtra.move(archivePath, tempPath)
                        .then(() => {
                            fsExtra.copy(tempPath, localPathRoot)
                                .then(() => {
                                    fsExtra.remove(tempPath).catch((error) => {
                                        throw error;
                                    });
                                })
                                .catch((error) => {
                                    throw error;
                                });
                        })
                        .catch((error) => {
                            throw error;
                        });
                }
                else {
                    await getArtifactsFromUrl(artifactQueryUrl, strictSSL, localPathRoot, itemPattern, handler, variables);
                }
            }
            else {
               console.log(tl.loc('NoAssociatedArtifacts'));
            }
        }

        console.log(tl.loc('ArtifactSuccessfullyDownloaded', localPathRoot));

        let downloadCommitsAndWorkItems: boolean = tl.getBoolInput("downloadCommitsAndWorkItems", false);
        if (downloadCommitsAndWorkItems) {
            if (tl.getBoolInput('propagatedArtifacts') == true) {
                try {
                    jenkinsJobDetails = await jenkinsClient.GetJobDetails();
                    console.log(tl.loc("FoundJenkinsJobDetails", jenkinsJobDetails.jobName, jenkinsJobDetails.jobType, jenkinsJobDetails.buildId, jenkinsJobDetails.multiBranchPipelineName));
//.........这里部分代码省略.........
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:101,代码来源:jenkinsdownloadartifacts.ts


示例6: renameFile

 renameFile(oldFileName: string, newFileName: string): Observable<void> {
     return from(move(oldFileName, newFileName, { overwrite: false }))
         .pipe(enterZone(this.ngZone));
 }
开发者ID:suiruiw,项目名称:geeks-diary,代码行数:4,代码来源:fs.service.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs-extra.moveSync函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs-extra.mkdtemp函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap