Coder Social home page Coder Social logo

file-uploader's Introduction

build status

File Uploader

Easily perform programmatic multi-part file uploads. Designed for use within test suites.

Usage

var uploader = require('file-uploader')

var file   // set to the path of the file you want to upload
var cookie // set a cookie if you require authorisation

var options = {
  host : 'localhost',
  port : 4000,
  path : '/upload',
  method : 'POST',
  encoding : 'utf8'
}

uploader.postFile(options, file, {Cookie: cookie}, function(err, res) {
  console.log(res.statusCode)
})

See Also

Credit

Originally inspired by Anand Prakash.

file-uploader's People

Contributors

timoxley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

krasimir barudo

file-uploader's Issues

Custom key keyname

Hello,

the module works ok for me, but there is no way to change the keyname of the uploaded post data. I.e it is hard-coded to 'attachment' in the module. Can you please change line 132 in index.js from:
... keyname: 'attachment' ...
to
... keyname: options.keyname || 'attachment' ...

That way I'll be able to use the module from here. Otherwise I'll use my own fork ;)

Multiple files in a single upload?

is it possible? I need to upload file pairs. also, the server currently expects (after the upload) an array of objects containing path and fieldname - will this tool generate that?

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.