{"id":26826694,"url":"https://github.com/hslam/mmap","last_synced_at":"2025-04-28T16:49:17.103Z","repository":{"id":57545297,"uuid":"284290489","full_name":"hslam/mmap","owner":"hslam","description":"Package mmap provides a way to memory-map a file.","archived":false,"fork":false,"pushed_at":"2021-05-21T13:57:49.000Z","size":36,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T11:32:41.681Z","etag":null,"topics":["darwin","go","golang","linux","mmap","msync","munmap","unix","windows"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hslam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-01T15:50:32.000Z","updated_at":"2024-01-15T08:33:18.000Z","dependencies_parsed_at":"2022-09-16T23:40:42.068Z","dependency_job_id":null,"html_url":"https://github.com/hslam/mmap","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fmmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fmmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fmmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fmmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hslam","download_url":"https://codeload.github.com/hslam/mmap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251348750,"owners_count":21575329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["darwin","go","golang","linux","mmap","msync","munmap","unix","windows"],"created_at":"2025-03-30T11:30:36.592Z","updated_at":"2025-04-28T16:49:17.075Z","avatar_url":"https://github.com/hslam.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mmap\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/hslam/mmap)](https://pkg.go.dev/github.com/hslam/mmap)\n[![Build Status](https://github.com/hslam/mmap/workflows/build/badge.svg)](https://github.com/hslam/mmap/actions)\n[![codecov](https://codecov.io/gh/hslam/mmap/branch/master/graph/badge.svg)](https://codecov.io/gh/hslam/mmap)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hslam/mmap?v=7e100)](https://goreportcard.com/report/github.com/hslam/mmap)\n[![LICENSE](https://img.shields.io/github/license/hslam/mmap.svg?style=flat-square)](https://github.com/hslam/mmap/blob/master/LICENSE)\n\nPackage mmap provides a way to memory-map a file.\n\n## Get started\n\n### Install\n```\ngo get github.com/hslam/mmap\n```\n### Import\n```\nimport \"github.com/hslam/mmap\"\n```\n### Usage\n#### Example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/hslam/mmap\"\n\t\"os\"\n)\n\nfunc main() {\n\tname := \"mmap\"\n\tfile, err := os.Create(name)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer os.Remove(name)\n\tdefer file.Close()\n\tstr := \"Hello world\"\n\tfile.Truncate(int64(len(str)))\n\tb, err := mmap.Open(int(file.Fd()), 0, len(str), mmap.READ|mmap.WRITE)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer mmap.Munmap(b)\n\tcopy(b, []byte(str))\n\tmmap.Msync(b)\n\tbuf := make([]byte, len(str))\n\tif n, err := file.Read(buf); err != nil {\n\t\tfmt.Println(err)\n\t} else {\n\t\tfmt.Println(string(buf[:n]))\n\t}\n}\n```\n\n### Output\n```\nHello world\n```\n\n### License\nThis package is licensed under a MIT license (Copyright (c) 2020 Meng Huang)\n\n\n### Author\nmmap was written by Meng Huang.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Fmmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhslam%2Fmmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Fmmap/lists"}