git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
faf7e12
Branches
Tags
develop-client_server
master
typescript
fs-words.git
server
source
helpers
file.ts
[mov] server
Christian Fraß
commited
faf7e12
at 2021-03-08 23:05:42
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); } ); } ) ); } }