noide
Version:
Web Editor built on hapi and nes websockets using browserify, superviews.js, bootstrap and the ACE editor.
81 lines (72 loc) • 1.34 kB
JavaScript
var client = require('./client')
function readFile (path, callback) {
client.request({
path: '/readfile?path=' + path,
method: 'GET'
}, callback)
}
function writeFile (path, contents, callback) {
client.request({
path: '/writefile',
payload: {
path: path,
contents: contents
},
method: 'PUT'
}, callback)
}
function mkdir (path, callback) {
client.request({
path: '/mkdir',
payload: {
path: path
},
method: 'POST'
}, callback)
}
function mkfile (path, callback) {
client.request({ path: '/mkfile',
payload: {
path: path
},
method: 'POST'
}, callback)
}
function copy (source, destination, callback) {
client.request({
path: '/copy',
payload: {
source: source,
destination: destination
},
method: 'POST'
}, callback)
}
function rename (oldPath, newPath, callback) {
client.request({
path: '/rename',
payload: {
oldPath: oldPath,
newPath: newPath
},
method: 'PUT'
}, callback)
}
function remove (path, callback) {
client.request({
path: '/remove',
payload: {
path: path
},
method: 'DELETE'
}, callback)
}
module.exports = {
mkdir: mkdir,
mkfile: mkfile,
copy: copy,
readFile: readFile,
writeFile: writeFile,
rename: rename,
remove: remove
}