Code Monkey home page Code Monkey logo

autouploader's Introduction

autoUploader

Endore Me

I will monitor a directory and upload files from it. I do this by POST-ing files to the remote server (as if I was a web form). I can also look for metadata files in this directory and add POST information from them along with the file.

Requirements

  • node.js V6 or later

Configuration Values

  • sourceDirectory: (string) The folder to be monitored
    • IE: "/Users/evantahler/Desktop/source/"
  • destinationDirectory: (string) If I am set, I will move uploaded files to this new directory after a successful upload.
  • IE: "/Users/evantahler/Desktop/dest/"
  • uploadHost: (string) The base URL of the upload server
  • IE: "mysweetserver.example.com"
  • uploadPath: (string) The "page" to upload to on the uploadHost
  • IE: "/upload.php"
  • uploadPort: (integer) The port to POST to on the uploadHost
    • IE: 80
  • uploadFileFieldName (sting) the field name that is used to uplaod the file
    • IE: "file"
  • metadataFile: (boolean) If I am true, I will not upload a file unless its corresponding metadata file is present.
    • IE: true
  • metadataFileExtension: (string) The file extension expected for metadata files
    • IE: ".json"
  • additionalUploadParams: (object) If there are any additional data fields that need to accompany an upload, put them here
    • IE: { password: "secret" }
  • checkCycleTime: (integer) How often to check sourceDirectory for new files
    • IE: 5000
  • logFolder: (string) where to keep the application's Log
    • IE: "./log/"
  • logFile: (string) the name of the application's log file
    • IE: "autoUploader.log"
  • maxLogFileSize: (integer) the largest the log file can get in bytes. It will be deleted and started over if it gets to large
    • IE: 100000

Notes

  • Metadata files should be in the JSON format, and end with .json
  • Metadata files should have the same basename as the main file
    • IE: the Metadata file for movie.mp4 would be movie.json
  • An example metadata file for movie.mp4 would be something like: { "first_name":"Evan", "last_name":"Tahler", "movie_name":"My Cool Movie!" }

Example Log Output

This is rendered to your shell and to the log file

2012-02-29 21:23:54 | Starting...
2012-02-29 21:23:54 | Checking folder: /Users/evantahler/Desktop/source/
2012-02-29 21:23:54 |   No files found
2012-02-29 21:24:09 | Checking folder: /Users/evantahler/Desktop/source/
2012-02-29 21:24:09 |   File: test.txt
2012-02-29 21:24:09 | 	Uploading: test.txt
2012-02-29 21:24:09 |   Uploaded!
2012-02-29 21:24:09 |   Files Moved
2012-02-29 21:24:14 | Checking folder: /Users/evantahler/Desktop/source/
2012-02-29 21:24:14 |   No files found

Thanks

autouploader's People

Contributors

evantahler avatar

Watchers

 avatar  avatar

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.