fs-extra APIs
- readFile
- existsSync
- writeFile
- pathExists
- readFileSync
- ensureDirSync
- ensureDir
- readdir
- remove
- readJson
- readdirSync
- stat
- writeFileSync
- readJSON
- copy
- readJsonSync
- writeJson
- readJSONSync
- ensureFile
- pathExistsSync
- copySync
- writeJSON
- createWriteStream
- statSync
- removeSync
- ensureFileSync
- mkdirSync
- emptyDir
- move
- unlink
- outputFile
- copyFileSync
- outputFileSync
- mkdirp
- ReadStream
- renameSync
- createFileSync
- lstatSync
- writeJSONSync
- copyFile
- open
- mkdirpSync
- close
- lstat
- outputJson
- fstat
- Stats
- rename
- read
- mkdir
- readlink
- emptydir
- createReadStream
- mkdtemp
- chmod
- FSWatcher
- Dirent
- appendFileSync
- truncateSync
- rmSync
- WriteOptions
- writeJsonSync
- rm
- unlinkSync
- SymlinkType
- mkdirs
- outputJsonSync
- emptyDirSync
- outputJSON
Other Related APIs
fs-extra#appendFileSync TypeScript Examples
The following examples show how to use
fs-extra#appendFileSync.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: file.ts From cli with Apache License 2.0 | 6 votes |
export function saveToEnvFile(
pathToEnv: string,
additionalEnvironment: Record<string, unknown>
) {
ensureFileSync(pathToEnv);
const environment = parse(readFileSync(pathToEnv, {encoding: 'utf-8'}));
const updatedEnvironment = {
...environment,
...additionalEnvironment,
};
truncateSync(pathToEnv);
for (const [key, value] of Object.entries(updatedEnvironment)) {
appendFileSync(pathToEnv, `${key}=${value}${EOL}`);
}
}