Comparing version 0.1.1 to 0.1.2
@@ -196,14 +196,9 @@ "use strict"; | ||
async rawData() { | ||
const handle = await fs.promises.open(this.filename, 'r'); | ||
const tagsStart = await this.tagsStart(); | ||
const numberOfTagsBytesBuffer = await read(handle.fd, Buffer.allocUnsafe(8), 0, 8, tagsStart + 8) | ||
.then(r => r.buffer); | ||
const numberOfTagsBytes = utils_1.byteArrayToLong(numberOfTagsBytesBuffer); | ||
const dataStart = tagsStart + 16 + numberOfTagsBytes; | ||
const dataStart = await this.dataStart(); | ||
const size = await this.size(); | ||
const dataSize = size - dataStart; | ||
if (dataSize === 0) { | ||
await handle.close(); | ||
return Buffer.allocUnsafe(0); | ||
} | ||
const handle = await fs.promises.open(this.filename, "r"); | ||
const dataBuffer = await read(handle.fd, Buffer.allocUnsafe(dataSize), 0, dataSize, dataStart) | ||
@@ -220,11 +215,2 @@ .then(r => r.buffer); | ||
const end = await this.size(); | ||
console.log(base64url_1.default(Buffer.concat([ | ||
utils_2.stringToBuffer('dataitem'), | ||
utils_2.stringToBuffer('1'), | ||
utils_2.stringToBuffer(await this.signatureType().then(n => n.toString())), | ||
await this.rawOwner(), | ||
await this.rawTarget(), | ||
await this.rawAnchor(), | ||
await this.rawTags() | ||
]))); | ||
const signatureData = await index_1.deepHash([ | ||
@@ -276,3 +262,3 @@ utils_2.stringToBuffer('dataitem'), | ||
await handle.close(); | ||
return tagsStart + 16 + numberOfTagsBytes; | ||
return tagsStart + 16 + numberOfTagsBytes + 1; | ||
} | ||
@@ -279,0 +265,0 @@ } |
{ | ||
"name": "arbundles", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Arweave bundling library", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -11,7 +11,7 @@ # Arweave Bundles | ||
```npm install ans104``` | ||
```npm install arbundles``` | ||
Using yarn: | ||
```yarn add ans104``` | ||
```yarn add arbundles``` | ||
@@ -21,3 +21,3 @@ ## Creating bundles | ||
```ts | ||
import { bundleAndSignData } from "ans104"; | ||
import { bundleAndSignData } from "arbundles"; | ||
@@ -31,3 +31,3 @@ const dataItems = [ | ||
const bundle = bundleAndSignData(dataItems, jwk); | ||
const bundle = await bundleAndSignData(dataItems, jwk); | ||
``` | ||
@@ -40,3 +40,3 @@ | ||
```ts | ||
import { createData } from "ans104"; | ||
import { createData } from "arbundles"; | ||
@@ -47,3 +47,3 @@ const data = { data: "some data" }; | ||
const dataItem = createData(data, signer); | ||
const dataItem = await createData(data, signer); | ||
@@ -62,3 +62,3 @@ // Get owner in base64url encoded string | ||
```ts | ||
const bundle = bundleAndSignData(dataItems, jwk); | ||
const bundle = await bundleAndSignData(dataItems, jwk); | ||
@@ -78,3 +78,3 @@ // Get by index | ||
```ts | ||
const bundle = bundleAndSignData(dataItems, jwk); | ||
const bundle = await bundleAndSignData(dataItems, jwk); | ||
@@ -88,3 +88,3 @@ // Convert bundle to Arweave transaction | ||
await arweave.transactions.sign(tx); | ||
await arweave.transactions.sign(tx, jwk); | ||
await arweave.transactions.post(tx); | ||
@@ -96,3 +96,3 @@ ``` | ||
```ts | ||
import { unbundleData } from "ans104"; | ||
import { unbundleData } from "arbundles"; | ||
@@ -106,3 +106,8 @@ const data = await arweave.transactions.getData("hKMMPNh_emBf8v_at1tFzNYACisyMQNcKzeeE1QE9p8"); | ||
This API is *experimental* so avoid use in production. There's one issue that exists that may affect it's overall | ||
functionality and could lead to breaking changes. | ||
The file API stores the items in the filesystem meaning you can bundle more items without hitting the NodeJS memory | ||
limit | ||
limit. | ||
Docs coming soon... |
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
103
90839
1934