@azure/storage-blob
Version:
Microsoft Azure Storage SDK for JavaScript - Blob
269 lines (268 loc) • 8.76 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var appendBlob_exports = {};
__export(appendBlob_exports, {
AppendBlobImpl: () => AppendBlobImpl
});
module.exports = __toCommonJS(appendBlob_exports);
var coreClient = __toESM(require("@azure/core-client"));
var Mappers = __toESM(require("../models/mappers.js"));
var Parameters = __toESM(require("../models/parameters.js"));
class AppendBlobImpl {
client;
/**
* Initialize a new instance of the class AppendBlob class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* The Create Append Blob operation creates a new append blob.
* @param contentLength The length of the request.
* @param options The options parameters.
*/
create(contentLength, options) {
return this.client.sendOperationRequest(
{ contentLength, options },
createOperationSpec
);
}
/**
* The Append Block operation commits a new block of data to the end of an existing append blob. The
* Append Block operation is permitted only if the blob was created with x-ms-blob-type set to
* AppendBlob. Append Block is supported only on version 2015-02-21 version or later.
* @param contentLength The length of the request.
* @param body Initial data
* @param options The options parameters.
*/
appendBlock(contentLength, body, options) {
return this.client.sendOperationRequest(
{ contentLength, body, options },
appendBlockOperationSpec
);
}
/**
* The Append Block operation commits a new block of data to the end of an existing append blob where
* the contents are read from a source url. The Append Block operation is permitted only if the blob
* was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version
* 2015-02-21 version or later.
* @param sourceUrl Specify a URL to the copy source.
* @param contentLength The length of the request.
* @param options The options parameters.
*/
appendBlockFromUrl(sourceUrl, contentLength, options) {
return this.client.sendOperationRequest(
{ sourceUrl, contentLength, options },
appendBlockFromUrlOperationSpec
);
}
/**
* The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version
* 2019-12-12 version or later.
* @param options The options parameters.
*/
seal(options) {
return this.client.sendOperationRequest({ options }, sealOperationSpec);
}
}
const xmlSerializer = coreClient.createSerializer(
Mappers,
/* isXml */
true
);
const createOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
201: {
headersMapper: Mappers.AppendBlobCreateHeaders
},
default: {
bodyMapper: Mappers.StorageError,
headersMapper: Mappers.AppendBlobCreateExceptionHeaders
}
},
queryParameters: [Parameters.timeoutInSeconds],
urlParameters: [Parameters.url],
headerParameters: [
Parameters.version,
Parameters.requestId,
Parameters.accept1,
Parameters.contentLength,
Parameters.metadata,
Parameters.leaseId,
Parameters.ifModifiedSince,
Parameters.ifUnmodifiedSince,
Parameters.encryptionKey,
Parameters.encryptionKeySha256,
Parameters.encryptionAlgorithm,
Parameters.ifMatch,
Parameters.ifNoneMatch,
Parameters.ifTags,
Parameters.blobCacheControl,
Parameters.blobContentType,
Parameters.blobContentMD5,
Parameters.blobContentEncoding,
Parameters.blobContentLanguage,
Parameters.blobContentDisposition,
Parameters.immutabilityPolicyExpiry,
Parameters.immutabilityPolicyMode,
Parameters.encryptionScope,
Parameters.blobTagsString,
Parameters.legalHold1,
Parameters.blobType1
],
isXML: true,
serializer: xmlSerializer
};
const appendBlockOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
201: {
headersMapper: Mappers.AppendBlobAppendBlockHeaders
},
default: {
bodyMapper: Mappers.StorageError,
headersMapper: Mappers.AppendBlobAppendBlockExceptionHeaders
}
},
requestBody: Parameters.body1,
queryParameters: [Parameters.timeoutInSeconds, Parameters.comp22],
urlParameters: [Parameters.url],
headerParameters: [
Parameters.version,
Parameters.requestId,
Parameters.contentLength,
Parameters.leaseId,
Parameters.ifModifiedSince,
Parameters.ifUnmodifiedSince,
Parameters.structuredBodyType,
Parameters.encryptionKey,
Parameters.encryptionKeySha256,
Parameters.encryptionAlgorithm,
Parameters.ifMatch,
Parameters.ifNoneMatch,
Parameters.ifTags,
Parameters.encryptionScope,
Parameters.transactionalContentMD5,
Parameters.transactionalContentCrc64,
Parameters.contentType1,
Parameters.accept2,
Parameters.structuredContentLength,
Parameters.maxSize,
Parameters.appendPosition
],
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "binary",
serializer: xmlSerializer
};
const appendBlockFromUrlOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
201: {
headersMapper: Mappers.AppendBlobAppendBlockFromUrlHeaders
},
default: {
bodyMapper: Mappers.StorageError,
headersMapper: Mappers.AppendBlobAppendBlockFromUrlExceptionHeaders
}
},
queryParameters: [Parameters.timeoutInSeconds, Parameters.comp22],
urlParameters: [Parameters.url],
headerParameters: [
Parameters.version,
Parameters.requestId,
Parameters.accept1,
Parameters.contentLength,
Parameters.leaseId,
Parameters.ifModifiedSince,
Parameters.ifUnmodifiedSince,
Parameters.encryptionKey,
Parameters.encryptionKeySha256,
Parameters.encryptionAlgorithm,
Parameters.ifMatch,
Parameters.ifNoneMatch,
Parameters.ifTags,
Parameters.encryptionScope,
Parameters.sourceIfModifiedSince,
Parameters.sourceIfUnmodifiedSince,
Parameters.sourceIfMatch,
Parameters.sourceIfNoneMatch,
Parameters.sourceContentMD5,
Parameters.copySourceAuthorization,
Parameters.fileRequestIntent,
Parameters.transactionalContentMD5,
Parameters.sourceUrl,
Parameters.sourceContentCrc64,
Parameters.sourceEncryptionKey,
Parameters.sourceEncryptionKeySha256,
Parameters.sourceEncryptionAlgorithm,
Parameters.maxSize,
Parameters.appendPosition,
Parameters.sourceRange1
],
isXML: true,
serializer: xmlSerializer
};
const sealOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
200: {
headersMapper: Mappers.AppendBlobSealHeaders
},
default: {
bodyMapper: Mappers.StorageError,
headersMapper: Mappers.AppendBlobSealExceptionHeaders
}
},
queryParameters: [Parameters.timeoutInSeconds, Parameters.comp23],
urlParameters: [Parameters.url],
headerParameters: [
Parameters.version,
Parameters.requestId,
Parameters.accept1,
Parameters.leaseId,
Parameters.ifModifiedSince,
Parameters.ifUnmodifiedSince,
Parameters.ifMatch,
Parameters.ifNoneMatch,
Parameters.appendPosition
],
isXML: true,
serializer: xmlSerializer
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AppendBlobImpl
});
//# sourceMappingURL=appendBlob.js.map