2021-01-14 13:21:07 +00:00
|
|
|
import ./ipfsobject
|
2021-01-12 10:48:26 +00:00
|
|
|
|
2021-01-14 13:21:07 +00:00
|
|
|
export ipfsobject
|
2021-01-12 10:48:26 +00:00
|
|
|
|
2021-01-14 13:21:07 +00:00
|
|
|
proc createObject*(file: File): IpfsObject =
|
2021-01-12 10:48:26 +00:00
|
|
|
let contents = file.readAll()
|
2021-01-14 13:21:07 +00:00
|
|
|
IpfsObject(data: cast[seq[byte]](contents))
|
2021-01-12 10:48:26 +00:00
|
|
|
|
2021-01-14 13:21:07 +00:00
|
|
|
proc writeToFile*(obj: IpfsObject, output: File) =
|
|
|
|
output.write(cast[string](obj.data))
|