const { readFile, stat } = require("../../filesystem.js")

const constants = require("./fs_constants.js");

const { promisify } = require("util");

let all = {
  constants,

  stat: promisify(async (path, opt, cb) => {
    if (typeof cb !== 'function') {
      cb = opt
      opt = null;
    }

    try {
      cb(null, todo("fs.Stats", await stat(path)))
    } catch (e) {
      cb(e, null);
    }
  }),

  readFile: (name, opt, callback) => {
    if (typeof callback !== 'function') {
      callback = opt
      opt = {}
    }
    if (typeof opt === 'string') {
    }

    readFile(name).then((content) => {
      callback(null, content)
    }).catch((err) => {
      callback(err, null)
    })
  }
}

let { todo } = require("./util.js")

module.exports = all
