第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何在 node-red. 中下載 tar 文件?

如何在 node-red. 中下載 tar 文件?

MMMHUHU 2023-04-27 16:13:13
我正在嘗試下載 node-red 中的 tar 文件。以下是我下載文件的 JavaScript 代碼。downloadTar(sendObj).then(res => {        var bytes = new Uint8Array(byte); // pass your byte response to this constructor        var blob = new Blob([bytes], {type: "application/tar"});        var link = document.createElement('a');        link.href = window.URL.createObjectURL(blob);        var fileName = 'genome.tar';        link.download = fileName;        link.click();});function downloadTar(data) {    return new Promise((resolve, reject) => {        $.ajax({            url: nodeRedDownloadTar,            type: 'POST',            data: data,            success: function (result) {                resolve(result);            }        });    });}以下是我的 Node-Red 流程,我正在讀取文件a single Buffer Object并將其發(fā)送到 http 響應(yīng)然后是我從后端得到的響應(yīng)。 問(wèn)題是沒(méi)有下載 tar 文件。我不確定我在哪里制造問(wèn)題。
查看完整描述

1 回答

?
慕雪6442864

TA貢獻(xiàn)1812條經(jīng)驗(yàn) 獲得超5個(gè)贊

以下流程正常工作,我使用 http-response 節(jié)點(diǎn)中的標(biāo)頭選項(xiàng)將內(nèi)容類型設(shè)置為appplication/x-tar


[

    {

        "id": "6e993a09.f44244",

        "type": "file in",

        "z": "1c834717.22be01",

        "name": "",

        "filename": "/home/pi/test.tar",

        "format": "",

        "chunk": false,

        "sendError": false,

        "encoding": "none",

        "x": 600,

        "y": 580,

        "wires": [

            [

                "6e7d5f6f.c9477"

            ]

        ]

    },

    {

        "id": "df49df3b.d325b",

        "type": "http in",

        "z": "1c834717.22be01",

        "name": "",

        "url": "/tar",

        "method": "post",

        "upload": false,

        "swaggerDoc": "",

        "x": 380,

        "y": 580,

        "wires": [

            [

                "6e993a09.f44244"

            ]

        ]

    },

    {

        "id": "6e7d5f6f.c9477",

        "type": "http response",

        "z": "1c834717.22be01",

        "name": "",

        "statusCode": "",

        "headers": {

            "content-type": "application/x-tar"

        },

        "x": 800,

        "y": 580,

        "wires": []

    }

]



查看完整回答
反對(duì) 回復(fù) 2023-04-27
  • 1 回答
  • 0 關(guān)注
  • 175 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)