Skip to content

Commit 93906d4

Browse files
committed
2 parents 5e32a63 + b6a233d commit 93906d4

1 file changed

Lines changed: 29 additions & 4 deletions

File tree

README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ You can use this as simple as using the TireMap.
5555
};
5656
```
5757
58+
5859
**unupgradable** : This means that if you upgrade your canister, you will discard files stored in the stablememory
5960
```motoko
6061
let bucket = Bucket.Bucket(false); // true : upgradable, false : unupgradabl
@@ -75,14 +76,26 @@ You can use this as simple as using the TireMap.
7576

7677
### API
7778

78-
- **put** :put the value into stablememory,use key to index
79+
- **put_replace** :put the value into stablememory,use key to index
80+
81+
​ Suitable for a single file block, if you add it again with the same key, it will overwrite the previous file
7982

8083
```motoko
81-
public func put(key: Text, value : Blob): Result.Result<(), Error>
84+
public func put_replace(key: Text, value : Blob): Result.Result<(), Error>
8285
```
8386

8487
tips: you can transform any type T to Text by using ``debug_show(t: T)``
8588

89+
- **put_append** :put the value into stablememory,use key to index
90+
91+
​ Suitable for multiple file blocks, if added again with the same key, it will be merged with the previous file block
92+
93+
```motoko
94+
public func put_append(key: Text, value : Blob): Result.Result<(), Error>
95+
```
96+
97+
tips: you can transform any type T to Text by using ``debug_show(t: T)`
98+
8699
- **get** : use the key to get the value
87100

88101
```motoko
@@ -123,14 +136,26 @@ Due to the problem of IC mainnet, HTTP-StreamingCallback cannot work at present,
123136

124137
### API
125138

126-
- **put** :put the value into stablememory,use key to index
139+
- **put_replace** :put the value into stablememory,use key to index
140+
141+
​ Suitable for a single file block, if you add it again with the same key, it will overwrite the previous file
127142

128143
```motoko
129-
public func put(key: Text, value : Blob): Result.Result<(), Error>
144+
public func put_replace(key: Text, value : Blob): Result.Result<(), Error>
130145
```
131146

132147
tips: you can transform any type T to Text by using ``debug_show(t: T)``
133148

149+
- **put_append** :put the value into stablememory,use key to index
150+
151+
​ Suitable for multiple file blocks, if added again with the same key, it will be merged with the previous file block
152+
153+
```motoko
154+
public func put_append(key: Text, value : Blob): Result.Result<(), Error>
155+
```
156+
157+
tips: you can transform any type T to Text by using ``debug_show(t: T)`
158+
134159
- **get** : use the key to get the value
135160

136161
```motoko

0 commit comments

Comments
 (0)