git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
1b85fc9
Branches
Tags
develop-client_server
master
typescript
fs-words.git
source
helpers
file.ts
[mod] makefile
Christian Fraß
commited
1b85fc9
at 2021-03-03 23:53:00
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.writeFileSync ( path, content, (error) => { if (error) reject(error); else resolve(undefined); } ); } ) ); } }