git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
67056ef
Branches
Tags
develop-client_server
master
typescript
fs-words.git
source
helpers
file.ts
[fix] helper:file
Christian Fraß
commited
67056ef
at 2021-03-04 08:17:18
file.ts
Blame
History
Raw
namespace helpers.file { /** */ export function read ( path : string ) : string { const nm_fs = require("fs"); const buffer : Buffer = nm_fs.readFileSync(path); const content : string = buffer.toString(); return content; } /** */ export function write ( path : string, content : string ) : Promise<void> { const nm_fs = require("fs"); return ( new Promise<void> ( (resolve, reject) => { nm_fs.writeFile ( path, content, (error) => { if (error) reject(error); else resolve(undefined); } ); } ) ); } }