repository-provider
Advanced tools
Comparing version 5.3.0 to 5.4.0
@@ -350,3 +350,3 @@ 'use strict'; | ||
} | ||
constructor(path, content = undefined, type = Content.TYPE_BLOB, mode = "100644") { | ||
constructor(path, content = undefined, type = Content.TYPE_BLOB, mode = "100644", sha) { | ||
if (path[0] === "/" || path.indexOf("\\") >= 0) { | ||
@@ -367,2 +367,10 @@ throw new TypeError(`Paths should not contain leading '/' or any '\\': ${path}`); | ||
}, | ||
sha: { | ||
get() { | ||
return sha; | ||
}, | ||
set(value) { | ||
sha = value; | ||
} | ||
}, | ||
type: { | ||
@@ -398,3 +406,4 @@ value: type | ||
type: this.type, | ||
mode: this.mode | ||
mode: this.mode, | ||
sha: this.sha | ||
}; | ||
@@ -401,0 +410,0 @@ } |
{ | ||
"name": "repository-provider", | ||
"version": "5.3.0", | ||
"version": "5.4.0", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -422,2 +422,3 @@ [![npm](https://img.shields.io/npm/v/repository-provider.svg)](https://www.npmjs.com/package/repository-provider) | ||
- `mode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** file permissions (optional, default `"100644"`) | ||
- `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** sha of the content | ||
@@ -430,2 +431,3 @@ ### Properties | ||
- `mode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** file permissions | ||
- `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** sha of the content | ||
@@ -432,0 +434,0 @@ ### isDirectory |
import toReadableStream from "to-readable-stream"; | ||
import { Stream } from 'stream'; | ||
import { Stream } from "stream"; | ||
@@ -11,2 +11,3 @@ /** | ||
* @property {string} mode file permissions | ||
* @property {string} sha sha of the content | ||
* | ||
@@ -17,2 +18,3 @@ * @param {string} path file name inside of the repository | ||
* @param {string} mode file permissions | ||
* @param {string} sha sha of the content | ||
*/ | ||
@@ -31,3 +33,4 @@ export class Content { | ||
type = Content.TYPE_BLOB, | ||
mode = "100644" | ||
mode = "100644", | ||
sha | ||
) { | ||
@@ -50,2 +53,10 @@ if (path[0] === "/" || path.indexOf("\\") >= 0) { | ||
}, | ||
sha: { | ||
get() { | ||
return sha; | ||
}, | ||
set(value) { | ||
sha = value; | ||
} | ||
}, | ||
type: { value: type }, | ||
@@ -91,3 +102,5 @@ mode: { value: mode } | ||
toStream() { | ||
return this.content instanceof Stream ? this.content : toReadableStream(this.content); | ||
return this.content instanceof Stream | ||
? this.content | ||
: toReadableStream(this.content); | ||
} | ||
@@ -99,3 +112,4 @@ | ||
type: this.type, | ||
mode: this.mode | ||
mode: this.mode, | ||
sha: this.sha | ||
}; | ||
@@ -102,0 +116,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63261
1625
496