Code Monkey home page Code Monkey logo

node-upyun's Issues

是否考虑支持流式上传?

这个模块现在实在是不够好用,听说在准备重构?请问是否有考虑支持流式上传?

现在的版本是,如果用户上传一张图片,服务端进行中转的话,服务端需要存临时文件,或者存在内存里,再进行转发,这其实是很浪费资源的,希望能够支持流式上传,祝又拍云越做越好。

关于uploadFile上传html文件

调用uploadFile上传html文件,上传成功了,文件也在又拍云上了。里面的数据也是正确的。返回的数据中statusCode是200,但是data是{}.求解

folder上传,求正确姿势~

我是这样写的

    var upyun= new UPYUN('xxx', 'yyy', 'zzz', 'v0', 'legacy')
    upyun.uploadFile(
      '/write/src/'
      ,'./build/web-mobile/src/*'
      ,'folder'
      ,true
//      ,[opts]
      ,(res, err)=>{
        console.log(res, err)
      }
    )

返回给我的信息是这样的

null { statusCode: 200,
  headers: 
   { server: 'vivi/0.6',
     'content-type': 'application/octet-stream',
     'transfer-encoding': 'chunked',
     connection: 'close',
     'x-request-id': '465d625402e3115870462f769173140c',
     date: 'Thu, 23 Jun 2016 02:21:10 GMT',
     etag: '"2834b292750dac521d3b8b0a83a33e3b"',
     'x-request-path': '403-zj-fud-200, ctn-hb-eez-200',
     'x-error-code': '50300006',
     'access-control-allow-origin': '*',
     'x-vivi-streaming': 'on' },
  data: {} }

但是在upyun manager客户端里看到write目录下只是多了一个无格式的src文件,点开write下原有的src目录里面也空了,手动在客户端里删掉那个无格式的src文件原来的src目录内容也正常了,求正确的folder上传姿势~

上传的文件包含中文字符,打开外链地址查看出现乱码。

原始文件内容:
{
"type": "ui-button",
"name": "ui-button1-general",
"w": 200,
"h": 69,
"x": 151,
"y": 164,
"text": "你好",
"vTextAlign": "middle",

上传之后在浏览器打开查看:
{
"type": "ui-button",
"name": "ui-button1-general",
"w": 200,
"h": 69,
"x": 151,
"y": 164,
"text": "浣犲ソ",
"vTextAlign": "middle",

btw:
外链地址:http://lcbucket1.b0.upaiyun.com/filex1.txt
上传文件:Content-Type: 'text/plain'
checksum: true

希望帮忙看看,谢谢:)

uploadFile方法有问题

uploadFile方法内,判断checksum有问题,如果传递checksum为false的话,下面代码的判断分支逻辑有错。

if(isFile && checksum === true) {
        contentLength = fs.statSync(localFile).size;
        utils.md5sumFile(localFile, function(err, result) {
            opts['Content-MD5'] = result;
            _upload(contentLength, opts);
        });
    } else if(isFile && typeof checksum === 'string') {
        contentLength = fs.statSync(localFile).size;
        opts['Content-MD5'] = checksum;
        _upload(contentLength, opts);
    } else {
        contentLength = localFile.length;
        opts['Content-MD5'] = utils.md5sum(localFile);
        _upload(contentLength, opts);
    }

listDir crashed when list a empty dir

there are error log:

/node_modules/upyun/node_modules/upyun-legacy/index.js:60
var files = result.data.split('\n').reduce(function(prev, curr, idx, a
^
TypeError: Cannot call method 'split' of undefined`

setPurge更新缓存问题

每次上传文件之后我都写了一个接口发送请求更新文件缓存。
但是本地测试每次都是返回:
message: '

401 Unauthorized

Sign error (sign = md5(PURGE&BUCKET&DATE&MD5(PASSWORD))), Sign error!'
我放到阿里云服务器去跑每次都是好好的。希望执教一下。

测试不通过


node-upyun git:(master) mocha


  API Version: 
    ✓ should return instance with legacy API 
    ✓ should return instance with latest API 

  REST API: 
    getUsage(callback)
      1) should return a result contains space and file
    listDir(remotePath, callback)
      2) should return a result contains files
    createDir(remotePath, callback)
      3) should return success code 201
    removeDir(remotePath, callback)
      4) should return 200
    uploadFile(remotePath, localFile, type, checksum, [opts], callback)
      5) should return the uploaded file's info
    uploadFile(remotePath, localFile, type, checksum, [opts], callback)
      6) should return the uploaded file's info
    existsFile(remotePath, callback)
      7) should return 200
    downloadFile(remotePath, callback)
      8) should return file's content
    removeFile(remotePath, callback)
      9) should return 200

  Error handle
    Sign error
      10) should return sign error
    No callback function
      ✓ should throw error 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.