Repository navigation
Expand file tree
/
Copy pathtest.html
More file actions
62 lines (54 loc) · 1.96 KB
/
Copy pathtest.html
File metadata and controls
62 lines (54 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<html lang="en-us">
<head>
<title></title>
<script src="storagepool.js"></script>
</head>
<body>
<script>
StoragePool("test-container").then(function (container) {
container.count().then(function (count) {
console.log("file count: " + count);
});
container.list().then(function (list) {
for (var i = 0; i <= list.length - 1; i++) {
console.log(i + ": " + list[i])
}
});
var blob = new container.StorageBlob("/test/path/test.png");
var fetch = function () {
blob.fetch("my-logo-black-small.png").then(function () {
blob.read().then(function (file) {
var url = window.URL || window.webkitURL;
var source = url.createObjectURL(file);
var test = document.createElement("img");
test.setAttribute("src", source);
document.getElementById("file").appendChild(test);
url.revokeObjectURL(file);
console.log(file);
});
});
};
var write = function () {
blob.write("This is the test contents of test.txt").then(function () {
blob.read().then(function (file) {
document.getElementById("file").innerText = file;
console.log(file);
});
});
};
blob.exists().then(function (exists) {
if (exists) {
blob.delete().then(function () {
// write();
fetch();
});
} else {
// write();
fetch();
}
});
});
</script>
<div id="file"></div>
</body>
</html>