feature(flop) create: only dir

This commit is contained in:
coderaiser 2014-06-20 04:00:25 -04:00
parent dc2a0ca3e6
commit bcedc6b7b5
3 changed files with 15 additions and 26 deletions

View file

@ -22,23 +22,7 @@
exports.create = function(path, type, callback) {
Util.checkArgs(arguments, ['path', 'callback']);
if (!callback) {
callback = type;
type = 'file';
}
if (!type)
type = 'file';
switch(type) {
case 'file':
fs.writeFile(path, '', callback);
break;
case 'dir':
mkdir(path, callback);
break;
}
mkdir(path, callback);
};
exports.read = function(path, type, callback) {
@ -136,7 +120,6 @@
switch(type) {
default:
console.log(ncp);
(ncp || pipe.create)(from, to, callback);
break;

View file

@ -35,7 +35,7 @@
if (!hash) {
error = 'hash: not suported, try update node';
callback(new Error(error));
func(new Error(error));
} else
pipe.create(name, hash, function (error) {
var hex;
@ -43,7 +43,9 @@
if (!error)
hex = hash.get();
callback(error, hex);
console.log(hex);
func(error, hex);
});
break;

View file

@ -2,15 +2,15 @@
'use strict';
var main = global.cloudcmd.main,
Util = main.util,
pipe = main.pipe,
path = require('path'),
fs = require('fs'),
dir = main.srvrequire('dir'),
diff = main.diff,
CloudFunc = main.cloudfunc,
DIR = '../../',
flop = require(DIR + 'flop');
DIR = '../../../',
DIR_SERVER = DIR + 'server/',
flop = require(DIR_SERVER + 'flop'),
Util = require(DIR + 'util'),
pipe = require(DIR_SERVER + 'pipe');
exports.onPut = onPut;
@ -31,6 +31,10 @@
break;
case 'file':
fs.writeFile(name, '', callback);
break;
default:
flop.write(name, readStream, 'unzip', function(error) {
var msg;
@ -43,7 +47,7 @@
break;
case 'patch':
dir.getSize(name, function(error, size) {
flop.read(name, 'size', function(error, size) {
var MAX_SIZE = CloudFunc.MAX_FILE_SIZE;
if (!error)