We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
overwrite
client.uploadFile
Take this sample code:
const WordPress = require( "wordpress" ); const fs = require('fs'); const client = WordPress.createClient({ url: "url", username: "username", password: "password" }); let file = fs.readFileSync(`/tmp/16508471_379760699056052_625556649633729067_n.jpg`); let uploadOptions = { name: '16508471_379760699056052_625556649633729067_n.jpg', type: 'image/jpeg', bits: file, overwrite: true }; client.uploadFile(uploadOptions, function (error, fileData) { console.log(fileData.attachment_id); //new ID on every upload console.log(fileData.metadata.file); //new file path (appending -number) on every upload console.log(fileData.file); //same as uploadOptions.name });
uploadOptions.overwrite is true. Anyway, a new (duplicated) file will be created on every run.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Take this sample code:
uploadOptions.overwrite is true. Anyway, a new (duplicated) file will be created on every run.
The text was updated successfully, but these errors were encountered: