Is it possible to use 'fs' (filesystem) mo

2019-09-05 12:10发布

问题:

I want to have access to filesystem on a page that is rendering by PhantomJS headless browser.

I catch an error when JS code is trying to interact with filesystem

var fs = require('fs');
...
ReferenceError: Can't find variable: require

Is there some hack/plugin to PhantomJS that allows to do that?

P.S. I'm using headless tests runner based on PhantomJS (teaspoon) and I want to store some data from tests on filesystem.