Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Commit

Permalink
added utilities package
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmdrz committed Jun 1, 2019
1 parent 2af6045 commit c9af8ed
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### A list of examples related to GoInsta
## A list of examples related to GoInsta

#### Follow Tag Bot

Expand Down
16 changes: 16 additions & 0 deletions utilities/export.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package utilities

import (
"bytes"

"github.com/ahmdrz/goinsta"
)

func ExportAsBytes(insta *goinsta.Instagram) ([]byte, error) {
buffer := &bytes.Buffer{}
err := goinsta.Export(insta, buffer)
if err != nil {
return nil, err
}
return buffer.Bytes(), nil
}
11 changes: 11 additions & 0 deletions utilities/import.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package utilities

import (
"bytes"

"github.com/ahmdrz/goinsta"
)

func ImportFromBytes(inputBytes []byte) (*goinsta.Instagram, error) {
return goinsta.ImportReader(bytes.NewReader(inputBytes))
}

0 comments on commit c9af8ed

Please sign in to comment.