1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Merge pull request #1824 from ZeroX-DG/fix-paste-image

Fixed image not displaying after paste
This commit is contained in:
Kazz Yokomizo
2018-04-26 22:39:03 +09:00
committed by GitHub
2 changed files with 13 additions and 4 deletions

View File

@@ -21,8 +21,12 @@ function copyImage (filePath, storageKey, rename = true) {
const imageDir = path.join(targetStorage.path, 'images')
if (!fs.existsSync(imageDir)) fs.mkdirSync(imageDir)
const outputImage = fs.createWriteStream(path.join(imageDir, basename))
outputImage.on('error', reject)
inputImage.on('error', reject)
inputImage.on('end', () => {
resolve(basename)
})
inputImage.pipe(outputImage)
resolve(basename)
} catch (e) {
return reject(e)
}