blob

IndexedDB: Store file as File or Blob or ArrayBuffer. What is the best option?

回眸只為那壹抹淺笑 提交于 2019-12-03 08:32:20
问题 Now most of browsers are supporting IndexedDB to store data/file directly as File , Blob or ArrayBuffer . This code saves a IDB key 'File1' as File <input type="file" id="userfile" /> var a = document.getElementById("userfile"); var b = a.files[0]; Now we can directly save this file to IDB using the following code //LocalForage is a library for indexedDB developed by Mozilla //Note: localforage._config.driver=asyncStorage (IDB method) function run(){ //"File1" = IDB data table key and b=value

Typescript blob filename without link

走远了吗. 提交于 2019-12-03 08:23:05
How to set file name for blob in typescript? For IE, I can setup file name easily but for Chrome it looks impossible. Basically I need something similar to this solution but with typescript downloadFile(data: any) { var blob = new Blob([data], {type: 'text/csv'}); let fileName = 'my-test.csv'; if (window.navigator && window.navigator.msSaveOrOpenBlob) { //save file for IE window.navigator.msSaveOrOpenBlob(blob, fileName); } else { //save for other browsers: Chrome, Firefox var objectUrl = URL.createObjectURL(blob); window.open(objectUrl); } } this function is called from html UI/angular 2:

Speed of mysql query on tables containing blob depends on filesystem cache

∥☆過路亽.° 提交于 2019-12-03 08:22:34
问题 I have a table with approximately 120k rows, which contains a field with a BLOB (not more than 1MB each entry in size, usually much less). My problem is that whenever I run a query asking any columns on this table ( not including the BLOB one), if the filesystem cache is empty, it takes approximately 40'' to complete. All subsequent queries on the same table require less than 1'' (testing from the command line client, on the server itself). The number of rows returned in the queries vary from

Error in streaming dynamic resource. null

丶灬走出姿态 提交于 2019-12-03 07:39:53
Important Notice : This issue has been fixed as of PrimeFaces 5.2 final (Community Release) released on April 8, 2015. As such if you happened to use that version or newer, you would not need to fiddle around with a temporary workaround. The earlier given example can now safely be modified as follows. public StreamedContent getImage() throws IOException { FacesContext context = FacesContext.getCurrentInstance(); if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { return new DefaultStreamedContent(); } else { String id = context.getExternalContext().getRequestParameterMap().get("id");

数据导出

孤人 提交于 2019-12-03 07:20:42
JS: export: function () { var checkStatus = table.checkStatus('tb-salary'), //lauui.table data = checkStatus.data; checkEmployeeSalaryIds = []; if (data.length >= 1) { //导出选中的数据 for (var i in data) { checkEmployeeSalaryIds.push(data[i].EmployeeSalaryId); } var url = '/Manager/Salary/ExportcheckSaleryData?checkEmployeeSalaryIds=' + checkEmployeeSalaryIds; var xhr = new XMLHttpRequest(); xhr.open('GET', url, true);//get请求,请求地址,是否异步 xhr.responseType = "blob"; // 返回类型blob xhr.onload = function () {// 请求完成处理函数 if (this.status === 200) { var blob = this.response;// 获取返回值 console.log(blob); var a =

uploading images to server in spring MVC and storing reference in mysql database [closed]

守給你的承諾、 提交于 2019-12-03 07:19:17
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I'm coding a Spring MVC 3.0 application with Tomcat as the web server. Our requirement is to let the user upload an image. I'm

convert image into blob using javascript

牧云@^-^@ 提交于 2019-12-03 07:14:01
问题 I use promise to download an image and get the image data like: promise.downloadFile().then(function(image){ //do something }); I have got the image, which is like: <img name="imageXXX" crossorigin="" src="/images/grass.jpg"> how can I convert the image into a blob? (Similar to below snippet) var blob = new Blob([????], "image/jpg"); how can I get/access the [????] from the image ? I don't know how to get the image context. 回答1: You can do this in two ways: Load the image source using

How can I insert into a BLOB column from an insert statement in sqldeveloper?

风流意气都作罢 提交于 2019-12-03 06:38:11
问题 Is it possible to insert into a BLOB column in oracle using sqldeveloper? i.e. something like: insert into mytable(id, myblob) values (1,'some magic here'); 回答1: Yes, it's possible, e.g. using the implicit conversion from RAW to BLOB: insert into blob_fun values(1, hextoraw('453d7a34')); 453d7a34 is a string of hexadecimal values, which is first explicitly converted to the RAW data type and then inserted into the BLOB column. The result is a BLOB value of 4 bytes. 回答2: To insert a VARCHAR2

Unable to retain line breaks when writing text file as blob

ぐ巨炮叔叔 提交于 2019-12-03 06:21:20
I have a text area that contains text that I want to output to a text file for users to download. I'm using this function to grab it when users click the save button function saveTextAsFile() { var textToWrite = document.getElementById("inputText").value; var textFileAsBlob = new Blob([textToWrite], {type:'text/plain'}); alert(textFileAsBlob); var fileNameToSaveAs = document.getElementById("inputFileNameToSaveAs").value; var downloadLink = document.createElement("a"); downloadLink.download = fileNameToSaveAs; downloadLink.innerHTML = "Download File"; if (window.webkitURL != null) { // Chrome

Node.JS reading BLOB from mysql

流过昼夜 提交于 2019-12-03 06:16:46
I'm using the Node.JS node-mysql module. One column has a BLOB type and want to read from it and if possible base64 encode it. I haven't been able to find anything on how to do this. Any ideas? Try the following snippet: var buffer = new Buffer( blob ); var bufferBase64 = buffer.toString('base64'); If your blob is binary, use the following instead: var buffer = new Buffer( blob, 'binary' ); var bufferBase64 = buffer.toString('base64'); You can also simplify that to one line: var bufferBase64 = new Buffer( blob, 'binary' ).toString('base64'); Of note: mysql-node automatically converts Blob