TypeError: e.createWriteStream is not a function
See original GitHub issueHi, I am trying to create a sample excel file but i am getting error ‘e.createWriteStream is not a function’. below is code to create the file-
import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';
import * as Excel from "exceljs/dist/exceljs.min.js";
import * as ExcelProper from "exceljs";
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(platform: Platform) {
platform.ready().then(() => {
this.createSheet();
});
}
ionViewDidLoad() {
}
createSheet() {
let workbook: ExcelProper.Workbook = new Excel.Workbook();
var worksheet = workbook.addWorksheet('My Sheet');
worksheet.columns = [
{ header: 'Id', key: 'id', width: 10 },
{ header: 'Name', key: 'name', width: 32 },
{ header: 'D.O.B.', key: 'DOB', width: 10 }
];
worksheet.addRow({ id: 1, name: 'Ionic Android', dob: new Date(1970, 1, 1) });
worksheet.addRow({ id: 2, name: 'Ionic iOS', dob: new Date(1965, 1, 7) });
var tempFilePath = 'PATH/temp.xlsx'; // PATH is where you want to create your file
workbook.xlsx.writeFile(tempFilePath).then(function () {
console.log('file is written');
});
}
}
This is my ionic info output:
@ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.1.4
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.0.2
Node : v6.11.3
npm : 3.10.10
OS : Windows 7
Environment Variables:
ANDROID_HOME : D:\ANDROID_SDK
Misc:
backend : pro
Please help me to get out of this issue.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:12
Top Results From Across the Web
Uncaught TypeError: fs.createWriteStream is not a function ...
I'm trying to export a formatted excel file using ExcelJS and the writeFile method simply isn't working.
Read more >TypeError: e.createWriteStream is not a function - Bountysource
I am trying to create a sample excel file but i am getting error 'e.createWriteStream is not a function'. below is code to...
Read more >TypeError: fs.createWriteStream is not a function in Node ...
I read through the Node documentation on fs and went through all the methods in the the fs/promises API and none of them...
Read more >Node.js v19.3.0 Documentation
If the function has not been called exactly exact times when ... The following, for instance, will throw the TypeError because there is...
Read more >Uncaught TypeError: fs.createWriteStream is not a function
Javascript – Uncaught TypeError: fs.createWriteStream is not a function ... I want to make a pdf file on client-side and afterwards it has...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And here it is how to use with buffer !
Hi @Ahmad19860, I don’t know if you could fix the problem but the problem is that you’re trying to execute a filesystem function on a webview.
The documentation says:
So, you wouuld need to use
wb.xlsx.writeBuffer()
instead ofwb.xlsx.writeFile()