Importing modules from node's standard library

35 views
Skip to first unread message

Martin Dederer

unread,
Oct 7, 2012, 1:36:05 PM10/7/12
to roy...@googlegroups.com
Is it possible to import nodejs modules without the proper roym module descriptor files in place? Currently importing modules which are part of node's api fails because no matching roym file can be found. That's a little annoying.

Brian McKenna

unread,
Oct 15, 2012, 11:00:14 AM10/15/12
to roy...@googlegroups.com
You should be able to do something like this:

let fs = require 'fs'

let passwd = fs.readFileSync '/etc/passwd' 'utf8'
console.log passwd

The un-nice thing is that the above is untyped - Roy can't know the
types in these modules without you writing a wrapper for it.
Reply all
Reply to author
Forward
0 new messages