blob

前端实现下载pdf文件

本小妞迷上赌 提交于 2019-12-06 12:48:36
1 async downloadFun() { // 下载使用说明书 2 const InstructionManualvv = await InstructionManual(); 3 4 let blob = new Blob([InstructionManualvv.data], {type: 'application/pdf;charset=UTF-8'}); 5 let fileName = '使用说明书.pdf'; 6 if (window.navigator.msSaveOrOpenBlob) { 7 navigator.msSaveBlob(blob, fileName) 8 } else { 9 var link = document.createElement('a'); 10 link.href = window.URL.createObjectURL(blob); 11 link.download = fileName; 12 link.click(); 13 window.URL.revokeObjectURL(link.href) //释放内存 14 } 15 }, 来源: https://www.cnblogs.com/xiaozhu-zhu/p/11984864.html

Read data from BLOB URL in Javascript

南笙酒味 提交于 2019-12-06 12:34:10
I have a BLOB URL, and I want to recreate it as a second BLOB URL, so that it is downloaded by default. var blob1 = new Blob(["Hello world!"], { type: "text/plain" }); url1 = window.URL.createObjectURL(blob1); blob2=new Blob([url1], {type: 'application/octet-stream'}); url2 = window.URL.createObjectURL(blob2); var a = document.createElement("a"); document.body.appendChild(a); a.style = "display: none"; a.href = url2; a.click(); window.URL.revokeObjectURL(url); See in JSFiddle: https://jsfiddle.net/7spry3jn/ But this only creates a text file containint the first URL. How can I Read data from

Compress GAE Blob images using Python Base64?

非 Y 不嫁゛ 提交于 2019-12-06 12:10:48
I'm pulling a JSON request of 20 random thumbnails to an iPhone application. At the moment I'm simply including the image thumb URLs in the JSON array (see below), then the iPhone goes out to get each image. This is really slow. Original JSON Request: { "item_list": [ { "item_name": "Item One", "user_item_thumb": "http://localhost:8080/i/agpwaGluZ28tYXBwcg4LEghJdGVtVXNlchgPDA/67x67", }, { "item_name": "Item Two", "user_item_thumb": "http://localhost:8080/i/agpwaGluZ28tYXBwcg4LEghJdGVtVXNlchgQDA/67x67", }, { "item_name": "Item Three", "user_item_thumb": "http://localhost:8080/i

enable caching of images specifying a modified date

为君一笑 提交于 2019-12-06 11:29:06
I've a jsp page which loads many images. I'd like to cache the images for faster loading. I'll explain my idea, please correct it if it's wrong. I'm calling the picture loading servlet for each image and return as a BLOB. My idea is to add a modified date with the image and the other values like Last-Modified, expires, Cache-control and max age. And thereby make the browser understand if the image changes. But how can i append a modified date to a BLOB? Or is there some better ideas to make them cachable? Thanks... I've a jsp page which loads many images. I'd like to cache the images for

Aforge Blob Detection

[亡魂溺海] 提交于 2019-12-06 10:59:45
How to detect Non Moving Blobs from a video? Let's consider I have a video and a initial background frame bitmap. Is that possible to detect an blob/object which is NOT MOVING ? and draw a rectangle around that Object? This reminds me of an algorithm to detect forgotten objects on a subway. If I'm not wrong you want to detect objects that are not moving AND that were not on the initial background right? You can apply this approach: With an initial image like this (couldn't find a truly empty subway image): And an image with an added static object (the waste can), the subway moving, and a

is it possible to set the contents (data) of a file upload input via javascript?

浪尽此生 提交于 2019-12-06 10:36:09
问题 i am using html5 canvas to alter an image. i would like to be able to use the resulting canvas image data to send to the server using the same file upload field . (alternately, it could be by adding a new field to the existing form ). i have converted the image to a Blob, but it seems that the only way to send this type of data to the server is using FormData, which requires its own (separate) XMLHttpRequest. this is not desirable for me. ( context : i am trying to essentially hijack any

How to convert BLOB to varchar with SAP HANA database using SQL

旧巷老猫 提交于 2019-12-06 10:19:13
问题 how do I cast a blob to varchar with SAP HANA database using SQL. (we need the column to be stored in blob - not TEXT - in else HANA automatically creates an index on this column. But we need an index with full-text-search and CORE_EXTRACTION) The following code select cast("DESCRIPTION" as varchar) "D" from "DESC" returns Could not execute 'select cast("DESCRIPTION" as varchar) "D" from "DESC"' in 30 ms 168 µs . SAP DBTech JDBC: [266]: inconsistent datatype: 回答1: Solved the problem with this

Create image serving URL for new Blob file

孤人 提交于 2019-12-06 09:37:04
After using the ImagesService to transform an uploaded image, I would like to store it back into a new Blob file and make it available through getServingUrl() as provided by the ImagesService. Storing the image in a new AppEngineFile as described here works fine and I am able to open and view it locally using the dev server. However when passing the blobKey for the new AppEngineFile to ImagesService.getServingUrl() a java.lang.IllegalArgumentException: Could not read blob. exception is thrown. Any ideas what the problem could be? This is the code I use to transform and store an uploaded image

upload base64 image data to Amazon S3

随声附和 提交于 2019-12-06 08:38:08
问题 Alright, in this phonegap app I start with a huge image file from the device's camera. Then I reduce the resolution and allow the user to crop it using javascript canvas and some very cool code called darkroomJS. At the end darkroomJS uses toDataURL() method to get base64 data out of the canvas. Now I need to upload it to Amazon S3. I can upload a file from my computer to S3 using a form just fine. What I'm working on is sending the base64 data. I also have a function that converts the base64

vue导出Excel文件

こ雲淡風輕ζ 提交于 2019-12-06 08:24:48
1、需要安装file-saver和script-loader、xlsx    npm install file-saver / yarn add file-saver npm install script-loader / yarn add script-loader npm install xlsx / yarn add xlsx    2、新建js文件(Blob.js和Export2Excel.js) Blob.js /* eslint-disable */ /* Blob.js*/ /*global self, unescape */ /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */ (function (view) { "use strict"; view.URL = view.URL || view.webkitURL; if (view.Blob && view.URL) { try { new Blob; return; } catch (e) { } } // Internally we use a BlobBuilder implementation to base Blob off of // in order to support older browsers