Browse Source

Fix Blob to Text conversion error

Ben Hsieh 8 years ago
parent
commit
7684d886ce
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/index.js

+ 2
- 1
src/index.js View File

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