Created
November 20, 2017 20:47
-
-
Save vbfox/98038b8bc0b34358cda3e6d0a33bbb91 to your computer and use it in GitHub Desktop.
Fable async node IO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AsyncIO | |
let private readdir (dir: string): Promise<ResizeArray<string>> = | |
Promise.Create(fun resolve fail -> | |
Fs.readdir(U2.Case1 dir, fun err files -> | |
if isDefined err then fail.Invoke(err) else resolve.Invoke(U2.Case1 files))) | |
let private unlink (path: string): Promise<unit> = | |
Promise.Create(fun resolve fail -> | |
Fs.unlink(U2.Case1 path, fun err -> | |
if isDefined err then fail.Invoke(err) else resolve.Invoke(U2.Case1 ()))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment