-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from domainr/wasm
add support for wasm/wasip1 build without mmap support
- Loading branch information
Showing
5 changed files
with
36 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//go:build windows && !appengine | ||
// +build windows,!appengine | ||
|
||
package maxminddb | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//go:build appengine || plan9 || js || wasip1 | ||
// +build appengine plan9 js wasip1 | ||
|
||
package maxminddb | ||
|
||
import "io/ioutil" | ||
|
||
// Open takes a string path to a MaxMind DB file and returns a Reader | ||
// structure or an error. The database file is opened using a memory map | ||
// on supported platforms. On platforms without memory map support, such | ||
// as WebAssembly or Google App Engine, the database is loaded into memory. | ||
// Use the Close method on the Reader object to return the resources to the system. | ||
func Open(file string) (*Reader, error) { | ||
bytes, err := ioutil.ReadFile(file) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return FromBytes(bytes) | ||
} | ||
|
||
// Close returns the resources used by the database to the system. | ||
func (r *Reader) Close() error { | ||
r.buffer = nil | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters