-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
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
How to override with outputFile? #195
Comments
By default See #197. |
@brunano21 as @triccardi-systran stated, the whole point of |
@jprichardson
Unfortunately the screenshot is saved only if the file does not exist. If it does, it's not overwritten. |
The problem is that you are not properly interfacing this library with promises. If you your snippet to work, you must either do the following:
Demonstrating 1: var fse = require('fs-extra')
...
return remote
.takeScreenshot()
.then(function (data) {
fse.outputFileSync(path + "/" + filename, data)
return remote;
}); Demonstrating 2: var fse = require('fs-extra')
...
return remote
.takeScreenshot()
.then(function (data) {
return new Promise(function (resolve, reject) {
fse.outputFile(path + "/" + filename, data, function(err) {
if (err) return reject(err)
else resolve(remote)
})
}) Demonstrating 3: var fse = require('fs-extra-promise')
...
return remote
.takeScreenshot()
.then(function (data) {
return fse.outputFileAsync(path + "/" + filename, data)
}) Hope that helps. |
I'm using the
outputFile
function but I would like to override the file if it already exists. However, seems it is not possible to pass anoption
to the function.How to accomplish that thus?
Edit: Even if it should override an existing file, this doesnt happen.
The text was updated successfully, but these errors were encountered: