【脚本语言】【RINGO JS】模块 fs

模块 fs

该模块提供了一个文件系统API,用于处理路径,目录,文件,链接以及输入和输出流的构造。 它遵循 CommonJS Filesystem/A 提议。

Example

// Writes a simple text file
var fs = require('fs');
if (!fs.exists('test.txt')) {
  var textStream = fs.open('test.txt', {
    write: true,
    binary: false
  });
  try {
    textStream.write('Hello World!');
    textStream.flush();
  } finally {
    textStream.close();
  }
  console.log('Wrote test.txt');
} else {
  console.error('test.txt already exists.');
}

Functions

猜你喜欢

转载自blog.csdn.net/lemon5814/article/details/83544582
今日推荐