Pārlūkot izejas kodu

Fix Blob to Text conversion error

Ben Hsieh 7 gadus atpakaļ
vecāks
revīzija
7684d886ce
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2
    1
      src/index.js

+ 2
- 1
src/index.js Parādīt failu

257
             Blob.build(this.data, { type : cType + ';BASE64' }).then(resolve)
257
             Blob.build(this.data, { type : cType + ';BASE64' }).then(resolve)
258
           break
258
           break
259
           case 'path':
259
           case 'path':
260
+            console.log('##', 'reading path')
260
             polyfill.Blob.build(wrap(this.data), { type : cType }).then(resolve)
261
             polyfill.Blob.build(wrap(this.data), { type : cType }).then(resolve)
261
           break
262
           break
262
           default:
263
           default:
276
           return base64.decode(this.data)
277
           return base64.decode(this.data)
277
         break
278
         break
278
         case 'path':
279
         case 'path':
279
-          return fs.readFile(this.data, 'utf8')
280
+          return fs.readFile(this.data, 'base64').then((b64) => Promise.resolve(base64.decode(b64)))
280
         break
281
         break
281
         default:
282
         default:
282
           return this.data
283
           return this.data