Skip to content

Instantly share code, notes, and snippets.

Avatar

Hayden Braxton haydenbr

View GitHub Profile
@haydenbr
haydenbr / blob-generator-function.ts
Created July 23, 2020 22:45
Use a generator function to partition a blob and upload blocks sequentially to Azure Storage
View blob-generator-function.ts
async function putBlocks(blob: Blob, url: string): Promise<string[]> {
const blockIds: string[] = []
let baseUrl = url + '&comp=block'
for (let { block, blockId } of partitionBlob(blob, BLOCK_SIZE)) {
blockIds.push(blockId)
await fetch(`${baseUrl}&blockid=${blockId}`, {
...DEFAULT_FETCH_SETTINGS,
headers: {
@haydenbr
haydenbr / cache-busting.js
Created October 5, 2017 17:51
ionic cache busting
View cache-busting.js
#!/usr/bin/env node
var fs = require('fs'),
path = require('path'),
cheerio = require('cheerio'),
revHash = require('rev-hash');
var rootDir = path.resolve(__dirname, '../');
var wwwRootDir = path.resolve(rootDir, 'platforms', 'browser', 'www');
var buildDir = path.join(wwwRootDir, 'build');