blob

如何在内存中创建文件供用户下载,而不是通过服务器下载?

▼魔方 西西 提交于 2019-12-20 16:38:59
有什么方法可以在客户端上创建文本文件并提示用户下载文本文件,而无需与服务器进行任何交互? 我知道我不能直接写给他们的机器(安全性和全部),但是我可以创建并提示他们保存吗? #1楼 您甚至可以做一个比URI更好的事情-使用Chrome,您还可以建议文件的名称,如 本博客文章中有关使用URI命名下载的 说明中 所述 。 #2楼 我很高兴使用 FileSaver.js 。 它的兼容性非常好(IE10 +和其他所有功能),并且使用非常简单: var blob = new Blob(["some text"], { type: "text/plain;charset=utf-8;", }); saveAs(blob, "thing.txt"); #3楼 适用于HTML5的浏览器的简单解决方案... function download(filename, text) { var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', filename); element.style.display = 'none';

SQL Server 2005/2008: Insert a File in an varbinary(max) column in Transact-SQL

[亡魂溺海] 提交于 2019-12-20 11:51:31
问题 Is it possible to insert a file in a varbinary(max) column in Transact-SQL? If yes, I would be very please to have a code snippet to at least give me an idea how to do that. Thanks 回答1: It's so easy - once you know it! :-) Found this on Greg Duncan's blog a while ago: INSERT INTO YourTable(YourVarbinaryColumn) SELECT * FROM OPENROWSET(BULK N'(name of your file to import)', SINGLE_BLOB) AS import And here's the MSDN library documentation on it. Marc 来源: https://stackoverflow.com/questions

Huge JavaScript HTML5 blob (from large ArrayBuffers) to build a giant file in client side

∥☆過路亽.° 提交于 2019-12-20 09:55:36
问题 I'm writing a web browser app (client-side) that downloads a huge amount of chunks from many locations and joins them to build a blob. Then that blob is saved to local filesystem as a common file. The way I'm doing this is by mean of ArrayBuffer objects and a blob. var blob = new Blob([ArrayBuffer1, ArrayBuffer2, ArrayBuffer3, ...], {type: mimetype}) This works ok for small and medium-sized files (until 700 MB aprox), but browser crashes with larger files. I understand that RAM memory has its

Processing image from the blob GAE

久未见 提交于 2019-12-20 07:10:07
问题 I managed to store a picture in the Google App engine blob (I can see it in the Blob Viewer from the dashboard, and also in my app using a serving handler).. However, now that i have this picture there..i want to resize it while serving it to the client...Problem is that i can't do that...I can't make an Image out of that blob...This is my code : from google.appengine.api import images from google.appengine.ext import blobstore from google.appengine.ext.webapp import blobstore_handlers ....

Why I got `Not allowed to load local resource` error on chrome when I use blob to load resource from ArrayBuffer?

不羁的心 提交于 2019-12-20 07:09:15
问题 I need to load an image from ArrayBuffer. I saw some articles says using Blob is the most efficient way to make it. This is the code I wrote to convert arraybuffer to blob url. const blob = new Blob([new Uint8Array(arrayBuffer, offset,length)], { type: mimeType }); url = window.URL.createObjectURL(blob); The array buffer is instance of array buffer that is created by slicing another array buffer fetched by XMLHttpRequest. And then, I tried to fetch the image from generated object URL like

How to avoid encoding warning when inserting binary data into a blob column in MySQL using Python 2.7 and MySQLdb

隐身守侯 提交于 2019-12-20 06:36:56
问题 I'm having trouble inserting binary data into a longblob column in MySQL using MySQLdb from Python 2.7, but I'm getting an encoding warning that I don't know how to get around: ./test.py:11: Warning: Invalid utf8 character string: '8B0800' curs.execute(sql, (blob,)) Here is the table definition: CREATE TABLE test_table ( id int(11) NOT NULL AUTO_INCREMENT, gzipped longblob, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; And the test code: #!/usr/bin/env python

Display BLOB image Laravel 4

泪湿孤枕 提交于 2019-12-20 06:27:54
问题 I have added png images as BLOB on mysql but when I try to retrieve them, I got them as files but can't display as images. Below is my code. //Controller public function post_news(){ $image = Input::file('image'); $filename = $image->getClientOriginalName(); $base64 = base64_encode($filename); $news = new News(); $news->title = Input::get('title'); $news->description = Input::get('desc'); $news->image = $filename; $news->save(); return Redirect::to('news')->withErrors(['This news has been

Excel not properly generate in angularjs

ぃ、小莉子 提交于 2019-12-20 06:07:17
问题 i am using angularjs and generate excel-sheet using blob with the help of filesaver.js i am getting my properly but excel will not open correctly in Micrsoft Excel it's working but i am not getting the cells it's shows black white page but content is there .help how to solve here i attached my fiddle:https://jsfiddle.net/x30v0bym/3/ 回答1: You can use the following directive, app .directive('excelExport', function() { return { restrict: 'A', scope: { fileName: "@", data: "&exportData" },

Excel not properly generate in angularjs

不羁的心 提交于 2019-12-20 06:07:03
问题 i am using angularjs and generate excel-sheet using blob with the help of filesaver.js i am getting my properly but excel will not open correctly in Micrsoft Excel it's working but i am not getting the cells it's shows black white page but content is there .help how to solve here i attached my fiddle:https://jsfiddle.net/x30v0bym/3/ 回答1: You can use the following directive, app .directive('excelExport', function() { return { restrict: 'A', scope: { fileName: "@", data: "&exportData" },

MySQL count(*) everyday in a month returns [BLOB-2B] instead of number

跟風遠走 提交于 2019-12-20 05:46:19
问题 I'm going to count every rows each day in a month with a specific user id(vwr_tid). Everything works fine - the result shows up in a table but one thing. A count each days doesn't comes up. It becomes [BLOB-xx] instead of number of rows that day. Here is my code : SELECT MONTH_v, YEAR_V, GROUP_CONCAT(IF(day_v=1, views, null)) AS '1', GROUP_CONCAT(IF(day_v=2, views, null)) AS '2', GROUP_CONCAT(IF(day_v=3, views, null)) AS '3', GROUP_CONCAT(IF(day_v=4, views, null)) AS '4', GROUP_CONCAT(IF(day