當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fs.copyFile函數代碼示例

本文整理匯總了TypeScript中fs.copyFile函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript copyFile函數的具體用法?TypeScript copyFile怎麽用?TypeScript copyFile使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了copyFile函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 vscode.workspace.getConfiguration().update("print.colourScheme", newValue, vscode.ConfigurationTarget.Global).then(() => {
   if (path !== stylePath) {
     let newCachePath = `${stylePath}/${newValue}.css`;
     fs.copyFile(p, newCachePath, err => {
       vscode.window.showErrorMessage(err.message);
     });
   }
 }, (err) => {
開發者ID:natkuhn,項目名稱:vsc-print,代碼行數:8,代碼來源:extension.ts

示例2: Promise

 return new Promise((resolve, reject) => {
   fs.copyFile(`${cwd}/${file}`, `${distDir}/${file}`, err => {
     if (err) {
       reject(err);
       return;
     }
     resolve();
   });
 });
開發者ID:johntdyer,項目名稱:grafana,代碼行數:9,代碼來源:grafanaui.build.ts

示例3: afterEach

 afterEach(async function () {
     if (this.currentTest.state && this.currentTest.state === "failed") {
         let png = await driver.logScreenshot(this.currentTest.title);
         fs.copyFile(png, "./mochawesome-report/" + this.currentTest.title + ".png", (err) => {
             if (err) throw err;
             console.log("Image saved");
         });
         addContext(this, "./" + this.currentTest.title + ".png");
     }
 });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:10,代碼來源:tests.e2e.ts

示例4: afterEach

 afterEach(async function () {
     if (this.currentTest.state && this.currentTest.state === "failed") {
         let png = await driver.logScreenshot(this.currentTest.title);
         fs.copyFile(png, './mochawesome-report/' + this.currentTest.title + '.png', function (err) {
             if (err) {
                 throw err;
             }
             console.log('Screenshot saved.');
         });
         addContext(this, './' + this.currentTest.title + '.png');
     }
 });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:12,代碼來源:tests.e2e.ts

示例5: cf

        s = fs.realpathSync.native('/path/to/folder', undefined);
        s = fs.realpathSync.native('/path/to/folder', 'utf8');
        b = fs.realpathSync.native('/path/to/folder', 'buffer');
        const v3 = fs.realpathSync.native('/path/to/folder', s);
        typeof v3 === "string" ? s = v3 : b = v3;

        s = fs.realpathSync.native('/path/to/folder', {});
        s = fs.realpathSync.native('/path/to/folder', { encoding: undefined });
        s = fs.realpathSync.native('/path/to/folder', { encoding: 'utf8' });
        b = fs.realpathSync.native('/path/to/folder', { encoding: 'buffer' });
        const v4 = fs.realpathSync.native('/path/to/folder', { encoding: s });
        typeof v4 === "string" ? s = v4 : b = v4;
    }

    {
        fs.copyFile('/path/to/src', '/path/to/dest', (err) => console.error(err));
        fs.copyFile('/path/to/src', '/path/to/dest', fs.constants.COPYFILE_EXCL, (err) => console.error(err));
        fs.copyFile('/path/to/src', '/path/to/dest', fs.constants.COPYFILE_FICLONE, (err) => console.error(err));
        fs.copyFile('/path/to/src', '/path/to/dest', fs.constants.COPYFILE_FICLONE_FORCE, (err) => console.error(err));

        fs.copyFileSync('/path/to/src', '/path/to/dest', fs.constants.COPYFILE_EXCL);
        fs.copyFileSync('/path/to/src', '/path/to/dest', fs.constants.COPYFILE_FICLONE);
        fs.copyFileSync('/path/to/src', '/path/to/dest', fs.constants.COPYFILE_FICLONE_FORCE);

        const cf = util.promisify(fs.copyFile);
        cf('/path/to/src', '/path/to/dest', fs.constants.COPYFILE_EXCL).then(console.log);
    }

    {
        fs.mkdir('some/test/path', {
            recursive: true,
開發者ID:Lavoaster,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:node-tests.ts

示例6: Promise

 return new Promise((resolve, reject) => {
   fs.copyFile(input, output, options, (error, ...args: any[]) => {
     error ? reject(error) : resolve.apply(null, args)
   })
 })
開發者ID:Blanket-Warriors,項目名稱:Blog-O-Matic,代碼行數:5,代碼來源:fsWrappers.ts


注:本文中的fs.copyFile函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。