zoukankan      html  css  js  c++  java
  • node csv

    想实现下载csv文件的功能,内容放在mysql的blob中,在网上找的都是关于csv模块的。

    由于csv的更新,网上的很多方法都用不了,比如csv(),现在已经变了:http://csv.adaltas.com/csv/examples/

    通过sudo npm install csv安装的csv模块,里面的example也是上述网址中得example。

    后来想想,当时把csv的内容直接存到blob中,现在把它拿出来,直接下载就好,应该不需要通过csv来处理,可以试一下。

    下载csv:http://www.nodeclass.com/articles/89571

    var filename = 'sfp.csv';
    res.set({
         // 文件扩展名:.xls 'Content-Type': 'application/vnd.ms-excel',
         // 当用户想把请求所得的内容存为一个文件的时候提供一个默认的文件名 'Content-Disposition': 'attachment;filename='+filename,
         //关于Pragma:no-cache,跟Cache-Control: no-cache相同。Pragma: no-cache兼容http 1.0 ,Cache-Control: no-cache是http 1.1提供的。因此,Pragma: no-cache可以应用到http 1.0 和http 1.1,而Cache-Control: no-cache只能应用于http 1.1. 'Pragma': 'no-cache', 'Expires': 0,
         'Cache-Control': 'No-cache' }); var str = 'Male,Female 54.,43. 23.,34. 45.,65. 54.,77. 45.,46. ,65.'; res.send(str);

      

  • 相关阅读:
    spring mvc + kafka实战
    springboot 实现文件下载功能
    vue前端文件下载
    父类和子类初始化顺序
    几种单例模式
    全链路压测注意点
    压力测试-ab
    压力测试-locust讲解
    Java httpClient 中get, post ,put(form-data & raw), delete方法使用
    RequestBody 和RequestEntity使用
  • 原文地址:https://www.cnblogs.com/wang-jing/p/4840826.html
Copyright © 2011-2022 走看看