Skip to content

Instantly share code, notes, and snippets.

View 3B00D's full-sized avatar

Abdulsalam Alshallah 3B00D

  • SEEK Asia
  • Malaysia
View GitHub Profile
@3B00D
3B00D / fileWatcherS3Sync.js
Last active September 28, 2017 15:32
Sync files to S3 automatically whenever they are modified/deleted.
var chokidar = require('chokidar')
var AWS = require('aws-sdk')
var fs = require('fs')
var s3 = new AWS.S3()
config = { destBucket: 'YOUR_BUCKET_NAME', directoryToWatch: 'path/to/your/directory/' }
function watchDirs(dirs) {
watcher = chokidar.watch(dirs, {
ignored: /[\/\\]\./,