Skip to content

banerjee-ronitb/aem-file-upload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aem-file-upload

This is a Node js utility to upload files to AEM. Sample Code Structure:

const DirectBinary = require('@adobe/aem-upload');
// URL to the folder in AEM where assets will be uploaded.
// Foldermust already exist
const targetUrl = 'https://author-pxxxxx-exxxxx.adobeaemcloud.com/content/dam/target';

// list of all local files that will be uploaded.
const uploadFiles = [
{
fileName: 'myasset.jpeg', // name of the file as it will appear in AEM
fileSize: 5242880, // total size, in bytes, of the file
filePath: '/Users/ronitbanerjee/Adobe/aem-file-upload/myasset.jpeg' // Full path to the local file
}
];

const upload = new DirectBinary.DirectBinaryUpload();
const options = new DirectBinary.DirectBinaryUploadOptions()
.withUrl(targetUrl)
.withBasicAuth('username:password')
.withUploadFiles(uploadFiles);

// this call will upload the files. The method returns a Promise, which will be resolved // when all files have uploaded. upload.uploadFiles(options)
.then(result => {
console.log(result);
}) .catch(err =>{
console.log(err);
});

About

Node JS Application for AEM File Upload

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published