Я пытаюсь преобразовать содержимое редактируемого div в текстовый файл и сохранить его в azure. Это на самом деле css файл (формат), но я думаю, что текст будет иметь тот же результат. Это то, что я получил до сих пор: \
var sasKey = "xxxxxxxxxxxxxxx";
var blobUri = xxxxx.blob.core.windows.net";
var blobService = AzureStorage.Blob.createBlobServiceWithSas(blobUri, sasKey);
function Save() {
var blobData = document.getElementById("CONTENT").innerText;
var myBlob = new Blob(blobData, "plain/text");
blobService.createBlockBlobFromBrowserFile('style',
"test.txt",
myBlob,
(error, result) => {
if (error) {
// Handle blob error
} else {
console.log('Upload is successful');
}
});
}
HTML:
<div id="CONTENT" contenteditable="true" spellcheck="false">so here we have text</div>
<input type="button" value="save" onclick="Save()"/>
я получаю следующую ошибку:
Uncaught TypeError: Failed to construct 'Blob': The provided value cannot be converted to a sequence.