title: using fs module in typescript and export a class
body: <p>In my Angular2 application, I'm trying to import fs and use it in my class then export it so that I could import in my app.component.ts</p>
  
  <pre><code>// foo.ts
  import * as fs from "fs"
  export class Foo {
    foo1() {
      fs.readFile('file.txt', (err, data) =&gt; {
        if (err) throw err
        return data
      })
    }
  }
  
  // app.component.ts
  import { Foo } from './foo.ts'
  .....
  export class AppComponent {
    foo: Foo;
    constructor() {
      this.foo = new Foo();
    }
  }
  </code></pre>
  
  <p>but my npm just told me that <code>404 GET /fs</code>
  I think I have successfully import <code>fs</code>, but I can't use <code>Foo.foo1()</code>
  Does any one know that?</p>
  
  <p>I tried to add <code>/// &lt;reference path='../node/node.d.ts' /&gt;</code> and it still can not work</p>
  
  <p>node: v.4.3.0</p>