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

TypeScript fs.copyFileSync函数代码示例

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

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



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

示例1: bootstrapSbtProject

function bootstrapSbtProject(buildSbtFileSource: string,
                             dottyPluginSbtFileSource: string) {
    fs.mkdirSync(sbtProjectDir)
    fs.appendFileSync(sbtBuildPropertiesFile, `sbt.version=${sbtVersion}`)
    fs.copyFileSync(buildSbtFileSource, sbtBuildSbtFile)
    fs.copyFileSync(dottyPluginSbtFileSource, path.join(sbtProjectDir, "plugins.sbt"))
}
开发者ID:dotty-staging,项目名称:dotty,代码行数:7,代码来源:extension.ts


示例2: syncConfigFiles

  private syncConfigFiles(filename: string): void {
    const dotfilesPath = join(__dirname, filename)
    const vscodePath = join(this.configPath, 'User', filename)

    if (!existsSync(vscodePath)) {
      console.info('  Using dotfiles version (target is missing)')
      copyFileSync(dotfilesPath, vscodePath)
    }

    if (readFileSync(dotfilesPath).toString() === readFileSync(vscodePath).toString()) {
      return
    }

    const dotfilesStat = statSync(dotfilesPath)
    const vscodeStat = statSync(vscodePath)

    console.info(`Config file '${filename}' has changed`)

    if (dotfilesStat.mtime > vscodeStat.mtime) {
      console.info('  Using dotfiles version')
      copyFileSync(dotfilesPath, vscodePath)
    } else {
      console.info('  Updating dotfiles version')
      copyFileSync(vscodePath, dotfilesPath)
    }
  }
开发者ID:elentok,项目名称:dotfiles,代码行数:26,代码来源:sync.ts


示例3: getExtraResource

(async () => {
    try {
        const options: packager.Options = {
            arch: "x64",
            asar: true,
            dir: ".",
            extraResource: await getExtraResource(),
            icon,
            ignore: getIgnore(),
            overwrite: true,
            platform: os.platform(),
            prune: true,

            appCopyright: "Copyright © 2018-present Envox d.o.o.",
            appVersion: packageJson.version
        };

        const appPaths = await packager(options);

        fs.copyFileSync("./LICENSE.TXT", appPaths[0] + "/LICENSE.EEZSTUDIO.TXT");
    } catch (err) {
        console.error(err);
    }

    process.exit();
})();
开发者ID:eez-open,项目名称:studio,代码行数:26,代码来源:build-installation.ts


示例4: copyFile

export function copyFile(src: string, dest: string, overwrite = true): boolean {
	try {
		copyFileSync(src, dest, overwrite ? undefined : constants.COPYFILE_EXCL)
	} catch (e) {
		switch (e.code) {
			case "ENOENT":
				// 区分是源文件不存在还是目标目录不存在
				try {
					accessSync(src)
				} catch (e2) {
					throw e
				}
				try {
					accessSync(dest)
				} catch (e3) {
					if (e3.code === "ENOENT") {
						ensureDirExists(dest)
						return copyFile(src, dest, false)
					} else {
						e = e3
					}
				}
				throw e
			case "EEXIST":
				return false
			default:
				throw e
		}
	}
	return true
}
开发者ID:tpack,项目名称:utilskit,代码行数:31,代码来源:fs.ts


示例5: async

gulp.task('vsix:release:package', async (onError) => {
    del.sync(vscodeignorePath);

    fs.copyFileSync(onlineVscodeignorePath, vscodeignorePath);

    try {
        await spawnNode([vscePath, 'package']);
    }
    finally {
        await del(vscodeignorePath);
    }
});
开发者ID:peterblazejewicz,项目名称:omnisharp-vscode,代码行数:12,代码来源:onlinePackagingTasks.ts


示例6: async

gulp.task('vsix:offline:package', async () => {
    del.sync(vscodeignorePath);

    fs.copyFileSync(offlineVscodeignorePath, vscodeignorePath);

    try {
        await doPackageOffline();
    }
    finally {
        del(vscodeignorePath);
    }
});
开发者ID:peterblazejewicz,项目名称:omnisharp-vscode,代码行数:12,代码来源:offlinePackagingTasks.ts


示例7: 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


示例8: copy

export function copy(src: string, dest: string, rename?: (dest: string) => string) {
	if (!fs.existsSync(src)) {
		return;
	}
	if (fs.statSync(src).isFile()) {
		fs.copyFileSync(src, rename ? rename(dest) : dest);
		return;
	}
	const fileNames = fs.readdirSync(src);
	mkdir(path.resolve(dest, "dummy"));
	fileNames.forEach((fileName) => {
		copy(path.resolve(src, fileName), path.resolve(dest, fileName), rename);
	});
}
开发者ID:enepomnyaschih,项目名称:jwidget,代码行数:14,代码来源:File.ts


示例9: Promise

const buildGoExecutable = (filename: string): Promise<void> => {
    const envGotify = process.env.GOTIFY_EXE;
    if (envGotify) {
        if (!fs.existsSync(testBuildPath)) {
            fs.mkdirSync(testBuildPath);
        }
        fs.copyFileSync(envGotify, filename);
        process.stdout.write(`### Copying ${envGotify} to ${filename}\n`);
        return Promise.resolve();
    } else {
        process.stdout.write(`### Building Gotify ${filename}\n`);
        return new Promise((resolve) =>
            exec(`go build  -o ${filename} ${appDotGo}`, () => resolve())
        );
    }
};
开发者ID:bradparks,项目名称:server,代码行数:16,代码来源:setup.ts


示例10: copyStatic

async function copyStatic(): Promise<void> {
  const files = [
    "LICENSE",
    "README.md",
    "CHANGELOG.md",
    "npm-shrinkwrap.json",
    "config/config-sample.json",
    "config/ext-sample.js",
    "public/logo.svg",
    "public/favicon.png"
  ];

  for (const file of files) {
    fs.copyFileSync(
      path.resolve(INPUT_DIR, file),
      path.resolve(OUTPUT_DIR, file)
    );
  }
}
开发者ID:zaidka,项目名称:genieacs,代码行数:19,代码来源:build.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs.createReadStream函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs.copyFile函数代码示例发布时间: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