Is it possible to use 'fs' (filesystem) module inside page executed by PhantomJS?

混江龙づ霸主 提交于 2019-12-25 05:36:08

问题


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.

来源:https://stackoverflow.com/questions/30779915/is-it-possible-to-use-fs-filesystem-module-inside-page-executed-by-phantomjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!